Re: [PATCH] dm vdo: Fix W=1 allmodconfig build error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/01/2025 01:24, Matthew Sakai wrote:
Hi John,

Hi Matt,


I'm all for getting rid of warnings where we can, but I'm not convinced this is the right approach here.

First, we use snprintf here because we really do want to limit the
string to 15 bytes.

Out of curiosity, why is that?

BTW, as I understand, for CONFIG_DM_VDO=m, the module name is "dm_vdo". So why different MODULE_NAME if MODULE is not defined ("dm-vdo")?

Making this constant larger doesn't maintain that. This change also increases the size of struct vdo (in vdo.h) by about 50 bytes. While that's not a lot, it does seem unnecessary.

In practice, we know that the our module name is only about 6 bytes, and the instance number will never be more than 3, so snprintf will never actually truncate anything here. Would checking for a non-zero return value suppress the error?

I'm also confused because I don't understand the difference between this line and the similar use of snprintf at drivers/md/dm-vdo/funnel- workqueue.c:430, which I presume does not trigger a warning?

For that snprintf usage, the compiler just doesn't know the possible length of @name, as it is a pointer. That is why it is a good reason to use snprintf.


Anyway, I'd be happy with a version that suppresses the warning without changing the size of any structures.

Matt Sakai

Thanks,
John




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux