Re: [PATCH 2/3] 9p: v9fs_listxattr: fix %s null argument warning

From: Dan Carpenter
Date: Tue Oct 24 2023 - 01:16:24 EST


On Tue, Oct 24, 2023 at 08:37:03AM +0900, Dominique Martinet wrote:
> W=1 warns about null argument to kprintf:
> In file included from fs/9p/xattr.c:12:
> In function ‘v9fs_xattr_get’,
> inlined from ‘v9fs_listxattr’ at fs/9p/xattr.c:142:9:
> include/net/9p/9p.h:55:2: error: ‘%s’ directive argument is null
> [-Werror=format-overflow=]
> 55 | _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Use an empty string instead of :
> - this is ok 9p-wise because p9pdu_vwritef serializes a null string
> and an empty string the same way (one '0' word for length)
> - since this degrades the print statements, add new single quotes for
> xattr's name delimter (Old: "file = (null)", new: "file = ''")
>
> Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
> Link: https://lore.kernel.org/r/20231008060138.517057-1-suhui@xxxxxxxxxxxx
> Suggested-by: Su Hui <suhui@xxxxxxxxxxxx>
> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> I've checked this works as expected (getfattr listing all user.* xattrs
> after setting some), so let's fix this warning.

Awesome. Thanks!

regards,
dan carpenter