public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
@ 2025-10-08 20:02 Markus Elfring
  2025-10-09  0:12 ` Steve French
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-08 20:02 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Bharath SM, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Steve French, Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Oct 2025 21:56:34 +0200

Return an error pointer without referencing another local variable
in an if branch of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2ops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 7c3e96260fd4..bb5eda032aa4 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -3216,9 +3216,8 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
 
 	utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
 	if (!utf16_path) {
-		rc = -ENOMEM;
 		free_xid(xid);
-		return ERR_PTR(rc);
+		return ERR_PTR(-ENOMEM);
 	}
 
 	oparms = (struct cifs_open_parms) {
-- 
2.51.0


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

* Re: [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
  2025-10-08 20:02 [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path() Markus Elfring
@ 2025-10-09  0:12 ` Steve French
       [not found] ` <CAH2r5mtpoLscs9sodXcRMO3-dqMDBSTR+ncExdqy4dQR=4uE8A@mail.gmail.com>
  2025-10-09 15:29 ` [PATCH] " Steve French
  2 siblings, 0 replies; 8+ messages in thread
From: Steve French @ 2025-10-09  0:12 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-cifs, samba-technical, Bharath SM, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Steve French, Tom Talpey, LKML,
	kernel-janitors

merged into cifs-2.6.git for-next

On Wed, Oct 8, 2025 at 3:02 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 Oct 2025 21:56:34 +0200
>
> Return an error pointer without referencing another local variable
> in an if branch of this function implementation.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  fs/smb/client/smb2ops.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 7c3e96260fd4..bb5eda032aa4 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -3216,9 +3216,8 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
>
>         utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
>         if (!utf16_path) {
> -               rc = -ENOMEM;
>                 free_xid(xid);
> -               return ERR_PTR(rc);
> +               return ERR_PTR(-ENOMEM);
>         }
>
>         oparms = (struct cifs_open_parms) {
> --
> 2.51.0
>
>


-- 
Thanks,

Steve

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

* Re: smb: client: Simplify a return statement in get_smb2_acl_by_path()
       [not found] ` <CAH2r5mtpoLscs9sodXcRMO3-dqMDBSTR+ncExdqy4dQR=4uE8A@mail.gmail.com>
@ 2025-10-09  5:17   ` Markus Elfring
       [not found]     ` <CAH2r5mtY8--9ccnm5aYfOYJ=kEBr7=y-Z_eROKDp7A6DGnxwcA@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2025-10-09  5:17 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey
  Cc: Steve French, LKML, kernel-janitors

> This is an example of one that is probably slightly worth it,

Thanks for such a positive indication.


> it shrinks one line of code, and also doesn't have risk,

Similar source code refinements might become also interesting and helpful.


> but at least three of the others today don't shrink and sometimes grow lines of code (and don't fix anything )

Further update candidates can be found and eventually transformed also with the help
of the semantic patch language (Coccinelle software).


> so are unlikely to be worth it since they slightly increase risk of adding difficulty to stable backports of future fixes

I hope that such change resistance can be reconsidered.

Regards,
Markus

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

* Re: smb: client: Simplify a return statement in get_smb2_acl_by_path()
       [not found]     ` <CAH2r5mtY8--9ccnm5aYfOYJ=kEBr7=y-Z_eROKDp7A6DGnxwcA@mail.gmail.com>
@ 2025-10-09 14:00       ` Markus Elfring
  2025-10-09 14:10         ` Steve French
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2025-10-09 14:00 UTC (permalink / raw)
  To: Steve French, linux-cifs, Bharath SM, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Tom Talpey
  Cc: Steve French, LKML

> Three of the four you just sent today, grow the code slightly,

How much will this observation matter?


> and don't fix anything,

Do these change suggestions indicate possible improvements according to specific design aspects?


> the remaining one could be considered

I am curious how the patch reviews will be evolving further.

Regards,
Markus

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

* Re: smb: client: Simplify a return statement in get_smb2_acl_by_path()
  2025-10-09 14:00       ` Markus Elfring
@ 2025-10-09 14:10         ` Steve French
  0 siblings, 0 replies; 8+ messages in thread
From: Steve French @ 2025-10-09 14:10 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-cifs, Bharath SM, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Steve French, LKML

On Thu, Oct 9, 2025 at 9:00 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > Three of the four you just sent today, grow the code slightly,
>
> How much will this observation matter?

Remember the goals here, the priorities:
1) Fixes for bugs
2) Performance improvements
3) Features that add support for missing Linux requirements (e.g.
adding O_TMPFILE or "rename_exchange support)
and then lower priority but still somewhat useful:
4) cleanup patches that remove unneeded code (although has to be
balanced against how it can hurt backports of important fixes),
ie cleanup that makes code *smaller* and therefore slightly easier to
read and maintain
5) cleanup code that adds or updates comments clarifying confusing code

Obviously "cleanup" patches that don't shrink code are often useless
(as they potentially break backports of patches for no value).




-- 
Thanks,

Steve

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

* Re: [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
  2025-10-08 20:02 [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path() Markus Elfring
  2025-10-09  0:12 ` Steve French
       [not found] ` <CAH2r5mtpoLscs9sodXcRMO3-dqMDBSTR+ncExdqy4dQR=4uE8A@mail.gmail.com>
@ 2025-10-09 15:29 ` Steve French
  2025-10-09 15:44   ` Markus Elfring
  2025-10-10  7:22   ` Markus Elfring
  2 siblings, 2 replies; 8+ messages in thread
From: Steve French @ 2025-10-09 15:29 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-cifs, samba-technical, Bharath SM, Paulo Alcantara,
	Ronnie Sahlberg, Shyam Prasad N, Steve French, Tom Talpey, LKML,
	kernel-janitors

As pointed out by the kernel test robot a few minutes ago, this patch
would introduce a regression (uninitialized rc variable in free_xid
macro), so will remove this patch from for-next.


On Wed, Oct 8, 2025 at 3:02 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 Oct 2025 21:56:34 +0200
>
> Return an error pointer without referencing another local variable
> in an if branch of this function implementation.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  fs/smb/client/smb2ops.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 7c3e96260fd4..bb5eda032aa4 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -3216,9 +3216,8 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
>
>         utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
>         if (!utf16_path) {
> -               rc = -ENOMEM;
>                 free_xid(xid);
> -               return ERR_PTR(rc);
> +               return ERR_PTR(-ENOMEM);
>         }
>
>         oparms = (struct cifs_open_parms) {
> --
> 2.51.0
>
>


-- 
Thanks,

Steve

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

* Re: [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
  2025-10-09 15:29 ` [PATCH] " Steve French
@ 2025-10-09 15:44   ` Markus Elfring
  2025-10-10  7:22   ` Markus Elfring
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-09 15:44 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Steve French,
	Tom Talpey, llvm, oe-kbuild-all
  Cc: LKML, kernel-janitors

> As pointed out by the kernel test robot a few minutes ago, this patch
> would introduce a regression (uninitialized rc variable in free_xid
> macro), so will remove this patch from for-next.

Will this (clang) compiler report be reconsidered once more under other circumstances?


…>> +++ b/fs/smb/client/smb2ops.c
>> @@ -3216,9 +3216,8 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
>>
>>         utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
>>         if (!utf16_path) {
>> -               rc = -ENOMEM;
>>                 free_xid(xid);
>> -               return ERR_PTR(rc);
>> +               return ERR_PTR(-ENOMEM);
>>         }
>>
>>         oparms = (struct cifs_open_parms) {
…

Can it be that the uninitialized rc variable would not really matter for
the adjusted statements in such an if branch?

Regards,
Markus

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

* Re: [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
  2025-10-09 15:29 ` [PATCH] " Steve French
  2025-10-09 15:44   ` Markus Elfring
@ 2025-10-10  7:22   ` Markus Elfring
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-10  7:22 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical, Bharath SM,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey
  Cc: Steve French, LKML, kernel-janitors, llvm, oe-kbuild-all

> As pointed out by the kernel test robot a few minutes ago, this patch
> would introduce a regression (uninitialized rc variable in free_xid
> macro), so will remove this patch from for-next.

Is there a need to express the tracing of return values in any other ways?
https://elixir.bootlin.com/linux/v6.17.1/source/fs/smb/client/cifsproto.h#L49-L58

Regards,
Markus

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

end of thread, other threads:[~2025-10-10  7:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 20:02 [PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path() Markus Elfring
2025-10-09  0:12 ` Steve French
     [not found] ` <CAH2r5mtpoLscs9sodXcRMO3-dqMDBSTR+ncExdqy4dQR=4uE8A@mail.gmail.com>
2025-10-09  5:17   ` Markus Elfring
     [not found]     ` <CAH2r5mtY8--9ccnm5aYfOYJ=kEBr7=y-Z_eROKDp7A6DGnxwcA@mail.gmail.com>
2025-10-09 14:00       ` Markus Elfring
2025-10-09 14:10         ` Steve French
2025-10-09 15:29 ` [PATCH] " Steve French
2025-10-09 15:44   ` Markus Elfring
2025-10-10  7:22   ` Markus Elfring

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