On 1/24/25 8:56 AM, Heinz Mauelshagen wrote:
Hi,
avoid needless format processing as in
+ "vdo%u", instance);
Indeed, I'll make this change.
On Fri, Jan 24, 2025 at 2:34 PM John Garry <john.g.garry@xxxxxxxxxx
<mailto:john.g.garry@xxxxxxxxxx>> wrote:
On 22/01/2025 22:30, Matthew Sakai wrote:
> Also remove MODULE_NAME and a BUG_ON check, both unneeded.
>
> This fixes a warning about string truncation in snprintf that
> will never happen in practice:
>
> drivers/md/dm-vdo/vdo.c: In function ‘vdo_make’:
> drivers/md/dm-vdo/vdo.c:564:5: error: ‘%s’ directive output may
be truncated writing up to 55 bytes into a region of size 16 [-
Werror=format-truncation=]
> "%s%u", MODULE_NAME, instance);
> ^~
> drivers/md/dm-vdo/vdo.c:563:2: note: ‘snprintf’ output between 2
and 66 bytes into a destination of size 16
> snprintf(vdo->thread_name_prefix, sizeof(vdo->thread_name_prefix),
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "%s%u", MODULE_NAME, instance);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Reported-by: John Garry<john.g.garry@xxxxxxxxxx
<mailto:john.g.garry@xxxxxxxxxx>>
> Signed-off-by: Matthew Sakai<msakai@xxxxxxxxxx
<mailto:msakai@xxxxxxxxxx>>
> ---
Looks ok:
Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx
<mailto:john.g.garry@xxxxxxxxxx>>
btw, maybe there is some #include which is not required since
MODULE_NAME is no longer referenced. I am not sure.
Cheers