[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56aa4f09-8f61-48f3-9836-687bf852b03a@kadam.mountain>
Date: Tue, 10 Oct 2023 10:51:32 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Su Hui <suhui@...china.com>
Cc: ericvh@...nel.org, lucho@...kov.net, asmadeus@...ewreck.org,
linux_oss@...debyte.com, v9fs@...ts.linux.dev,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] fs/9p/xattr.c: avoid format-overflow warning
On Sun, Oct 08, 2023 at 02:01:39PM +0800, Su Hui wrote:
> with gcc and W=1 option, there's a warning like this:
>
> 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 "" replace NULL to silence this warning.
>
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
> fs/9p/xattr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
> index e00cf8109b3f..d995ee080835 100644
> --- a/fs/9p/xattr.c
> +++ b/fs/9p/xattr.c
> @@ -139,7 +139,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
>
> ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> {
> - return v9fs_xattr_get(dentry, NULL, buffer, buffer_size);
> + return v9fs_xattr_get(dentry, "", buffer, buffer_size);
I'm pretty uncomfortable with this patch... This code is 13 years old
so it can't be too huge of a problem. We're doing this for the printks,
but now they're going to look weird first of all.
Old: "file = (null)"
New: "file = "
But also this must have some other effects on runtime right?
regards,
dan carpenter
Powered by blists - more mailing lists