Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb/client: clean up a type issue in cifs_xattr_get()
@ 2026-06-11  7:34 Dan Carpenter
  2026-06-11 20:33 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2026-06-11  7:34 UTC (permalink / raw)
  To: Steve French
  Cc: Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
	Bharath SM, linux-cifs, samba-technical, linux-kernel,
	kernel-janitors

The cifs_xattr_get() function returns type int, not ssize_t so
declare "rc" as int as well.  This has no effect on runtime.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 fs/smb/client/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
index 23227f2f9428..5091f6c0d7fe 100644
--- a/fs/smb/client/xattr.c
+++ b/fs/smb/client/xattr.c
@@ -272,7 +272,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
 			  struct dentry *dentry, struct inode *inode,
 			  const char *name, void *value, size_t size)
 {
-	ssize_t rc = -EOPNOTSUPP;
+	int rc = -EOPNOTSUPP;
 	unsigned int xid;
 	struct super_block *sb = dentry->d_sb;
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -354,7 +354,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
 				inode, full_path, &acllen, extra_info);
 		if (IS_ERR(pacl)) {
 			rc = PTR_ERR(pacl);
-			cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
+			cifs_dbg(VFS, "%s: error %d getting sec desc\n",
 				 __func__, rc);
 		} else {
 			if (value) {
-- 
2.53.0


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

* Re: [PATCH] smb/client: clean up a type issue in cifs_xattr_get()
  2026-06-11  7:34 [PATCH] smb/client: clean up a type issue in cifs_xattr_get() Dan Carpenter
@ 2026-06-11 20:33 ` Steve French
  2026-06-12 11:27   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2026-06-11 20:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs, Shyam Prasad N, Paulo Alcantara,
	kernel-janitors, samba-technical, linux-kernel, Tom Talpey,
	Bharath SM

Doesn't your patch need a cast in the following code in xattr.c since
it returns a ssize_t and you changed rc to int with your patch?

315                 if (pTcon->ses->server->ops->query_all_EAs)
316                         rc =
pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
317                                 full_path, name, value, size, cifs_sb);


On Thu, Jun 11, 2026 at 4:00 AM Dan Carpenter via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> The cifs_xattr_get() function returns type int, not ssize_t so
> declare "rc" as int as well.  This has no effect on runtime.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>  fs/smb/client/xattr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
> index 23227f2f9428..5091f6c0d7fe 100644
> --- a/fs/smb/client/xattr.c
> +++ b/fs/smb/client/xattr.c
> @@ -272,7 +272,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
>                           struct dentry *dentry, struct inode *inode,
>                           const char *name, void *value, size_t size)
>  {
> -       ssize_t rc = -EOPNOTSUPP;
> +       int rc = -EOPNOTSUPP;
>         unsigned int xid;
>         struct super_block *sb = dentry->d_sb;
>         struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
> @@ -354,7 +354,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
>                                 inode, full_path, &acllen, extra_info);
>                 if (IS_ERR(pacl)) {
>                         rc = PTR_ERR(pacl);
> -                       cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
> +                       cifs_dbg(VFS, "%s: error %d getting sec desc\n",
>                                  __func__, rc);
>                 } else {
>                         if (value) {
> --
> 2.53.0
>
>


-- 
Thanks,

Steve

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

* Re: [PATCH] smb/client: clean up a type issue in cifs_xattr_get()
  2026-06-11 20:33 ` Steve French
@ 2026-06-12 11:27   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-06-12 11:27 UTC (permalink / raw)
  To: Steve French
  Cc: Steve French, linux-cifs, Shyam Prasad N, Paulo Alcantara,
	kernel-janitors, samba-technical, linux-kernel, Tom Talpey,
	Bharath SM

On Thu, Jun 11, 2026 at 03:33:50PM -0500, Steve French wrote:
> Doesn't your patch need a cast in the following code in xattr.c since
> it returns a ssize_t and you changed rc to int with your patch?
> 
> 315                 if (pTcon->ses->server->ops->query_all_EAs)
> 316                         rc =
> pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
> 317                                 full_path, name, value, size, cifs_sb);
> 

It's not required.  The ->query_all_EAs() pointer returns ssize_t but
the two functions which implement ->query_all_EAs(), CIFSSMBQAllEAs()
and smb2_query_eas() return an rc variable which is an int.

I would tend to leave it out, but if you want I can add it if you
would prefer.

My real motivation for making this change is that we have an
"acllen = -ERANGE;" assignment where acllen is a u32.  Then we
store the -ERANGE in a signed long and Smatch triggers a warning
at that point.  But then we truncate away the upper 32 bits so it
ends being fine.

regards,
dan carpenter


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

end of thread, other threads:[~2026-06-12 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11  7:34 [PATCH] smb/client: clean up a type issue in cifs_xattr_get() Dan Carpenter
2026-06-11 20:33 ` Steve French
2026-06-12 11:27   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox