All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer
@ 2016-07-29 11:10 Nicolas Iooss
  2016-07-29 13:07 ` Andrey Ryabinin
  2016-07-29 19:53 ` Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Iooss @ 2016-07-29 11:10 UTC (permalink / raw)
  To: Andrew Morton, Andrey Ryabinin; +Cc: linux-kernel, Nicolas Iooss

handle_object_size_mismatch() used %pk to format a kernel pointer in
pr_err().  This seems to be a misspelling for %pK.

Fixes: c6d308534aef ("UBSAN: run-time undefined behavior sanity checker")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 lib/ubsan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ubsan.c b/lib/ubsan.c
index 8799ae5e2e42..d57d1e7e98a3 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -308,7 +308,7 @@ static void handle_object_size_mismatch(struct type_mismatch_data *data,
 		return;
 
 	ubsan_prologue(&data->location, &flags);
-	pr_err("%s address %pk with insufficient space\n",
+	pr_err("%s address %pK with insufficient space\n",
 		type_check_kinds[data->type_check_kind],
 		(void *) ptr);
 	pr_err("for an object of type %s\n", data->type->type_name);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer
  2016-07-29 11:10 [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer Nicolas Iooss
@ 2016-07-29 13:07 ` Andrey Ryabinin
  2016-07-29 19:53 ` Joe Perches
  1 sibling, 0 replies; 6+ messages in thread
From: Andrey Ryabinin @ 2016-07-29 13:07 UTC (permalink / raw)
  To: Nicolas Iooss, Andrew Morton; +Cc: linux-kernel

On 07/29/2016 02:10 PM, Nicolas Iooss wrote:
> handle_object_size_mismatch() used %pk to format a kernel pointer in
> pr_err().  This seems to be a misspelling for %pK.
> 
> Fixes: c6d308534aef ("UBSAN: run-time undefined behavior sanity checker")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>  lib/ubsan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/ubsan.c b/lib/ubsan.c
> index 8799ae5e2e42..d57d1e7e98a3 100644
> --- a/lib/ubsan.c
> +++ b/lib/ubsan.c
> @@ -308,7 +308,7 @@ static void handle_object_size_mismatch(struct type_mismatch_data *data,
>  		return;
>  
>  	ubsan_prologue(&data->location, &flags);
> -	pr_err("%s address %pk with insufficient space\n",
> +	pr_err("%s address %pK with insufficient space\n",

I don't see much sense in using %pK here. It should be fine to use just '%p' here as we already use it in handle_missaligned_access().

>  		type_check_kinds[data->type_check_kind],
>  		(void *) ptr);
>  	pr_err("for an object of type %s\n", data->type->type_name);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer
  2016-07-29 11:10 [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer Nicolas Iooss
  2016-07-29 13:07 ` Andrey Ryabinin
@ 2016-07-29 19:53 ` Joe Perches
  2016-07-30  8:26   ` Nicolas Iooss
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2016-07-29 19:53 UTC (permalink / raw)
  To: Nicolas Iooss, Andrew Morton, Andrey Ryabinin; +Cc: linux-kernel

On Fri, 2016-07-29 at 13:10 +0200, Nicolas Iooss wrote:
> handle_object_size_mismatch() used %pk to format a kernel pointer in
> pr_err().  This seems to be a misspelling for %pK.

Thanks


> diff --git a/lib/ubsan.c b/lib/ubsan.c
[]
> @@ -308,7 +308,7 @@ static void handle_object_size_mismatch(struct
> type_mismatch_data *data,
>  		return;
>  
>  	ubsan_prologue(&data->location, &flags);
> -	pr_err("%s address %pk with insufficient space\n",
> +	pr_err("%s address %pK with insufficient space\n",
>  		type_check_kinds[data->type_check_kind],
>  		(void *) ptr);
>  	pr_err("for an object of type %s\n", data->type->type_name);

Maybe change this to a single output line:

	pr_err("%s address %pK with insufficient space for an object of type %s\n",
	       type_check_kinds[data->type_check_kind], (void *)ptr,
	       data->type->type_name);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer
  2016-07-29 19:53 ` Joe Perches
@ 2016-07-30  8:26   ` Nicolas Iooss
  2016-07-30  8:30     ` [PATCH 1/1] UBSAN: fix typo in format string Nicolas Iooss
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Iooss @ 2016-07-30  8:26 UTC (permalink / raw)
  To: Joe Perches, Andrey Ryabinin; +Cc: Andrew Morton, linux-kernel

On 07/29/2016 09:53 PM, Joe Perches wrote:
> On Fri, 2016-07-29 at 13:10 +0200, Nicolas Iooss wrote:
>> handle_object_size_mismatch() used %pk to format a kernel pointer in
>> pr_err().  This seems to be a misspelling for %pK.
> 
> Thanks

Thanks for your feedbacks. I agree %pK does not make much sense in the
context it is used. I will modify this patch to use %p instead.

>> diff --git a/lib/ubsan.c b/lib/ubsan.c
> []
>> @@ -308,7 +308,7 @@ static void handle_object_size_mismatch(struct
>> type_mismatch_data *data,
>>  		return;
>>  
>>  	ubsan_prologue(&data->location, &flags);
>> -	pr_err("%s address %pk with insufficient space\n",
>> +	pr_err("%s address %pK with insufficient space\n",
>>  		type_check_kinds[data->type_check_kind],
>>  		(void *) ptr);
>>  	pr_err("for an object of type %s\n", data->type->type_name);
> 
> Maybe change this to a single output line:
> 
> 	pr_err("%s address %pK with insufficient space for an object of type %s\n",
> 	       type_check_kinds[data->type_check_kind], (void *)ptr,
> 	       data->type->type_name);

As both handle_missaligned_access() and handle_object_size_mismatch()
use two pr_err() calls to display their error messages, it seems the
split has been made on purpose (maybe to avoid logging long lines).
I won't merge the calls in my patch as this appears to be more an
ergonomic subject for people really using this code.

-- Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] UBSAN: fix typo in format string
  2016-07-30  8:26   ` Nicolas Iooss
@ 2016-07-30  8:30     ` Nicolas Iooss
  2016-08-01 11:47       ` Andrey Ryabinin
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Iooss @ 2016-07-30  8:30 UTC (permalink / raw)
  To: Andrew Morton, Andrey Ryabinin, Joe Perches; +Cc: linux-kernel, Nicolas Iooss

handle_object_size_mismatch() used %pk to format a kernel pointer with
pr_err().  This seemed to be a misspelling for %pK, but using this to
format a kernel pointer does not make much sence here.

Therefore use %p instead, like in handle_missaligned_access().

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 lib/ubsan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ubsan.c b/lib/ubsan.c
index 8799ae5e2e42..fb0409df1bcf 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -308,7 +308,7 @@ static void handle_object_size_mismatch(struct type_mismatch_data *data,
 		return;
 
 	ubsan_prologue(&data->location, &flags);
-	pr_err("%s address %pk with insufficient space\n",
+	pr_err("%s address %p with insufficient space\n",
 		type_check_kinds[data->type_check_kind],
 		(void *) ptr);
 	pr_err("for an object of type %s\n", data->type->type_name);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UBSAN: fix typo in format string
  2016-07-30  8:30     ` [PATCH 1/1] UBSAN: fix typo in format string Nicolas Iooss
@ 2016-08-01 11:47       ` Andrey Ryabinin
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Ryabinin @ 2016-08-01 11:47 UTC (permalink / raw)
  To: Nicolas Iooss, Andrew Morton, Joe Perches; +Cc: linux-kernel

On 07/30/2016 11:30 AM, Nicolas Iooss wrote:
> handle_object_size_mismatch() used %pk to format a kernel pointer with
> pr_err().  This seemed to be a misspelling for %pK, but using this to
> format a kernel pointer does not make much sence here.
> 
> Therefore use %p instead, like in handle_missaligned_access().
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-01 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 11:10 [PATCH 1/1] UBSAN: use uppercase K to format a kernel pointer Nicolas Iooss
2016-07-29 13:07 ` Andrey Ryabinin
2016-07-29 19:53 ` Joe Perches
2016-07-30  8:26   ` Nicolas Iooss
2016-07-30  8:30     ` [PATCH 1/1] UBSAN: fix typo in format string Nicolas Iooss
2016-08-01 11:47       ` Andrey Ryabinin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.