* [PATCH] net: sunrpc: sizeof('\0') is 4, not 1
@ 2023-12-15 23:53 Ahelenia Ziemiańska
2023-12-16 4:27 ` NeilBrown
0 siblings, 1 reply; 5+ messages in thread
From: Ahelenia Ziemiańska @ 2023-12-15 23:53 UTC (permalink / raw)
Cc: Trond Myklebust, Anna Schumaker, Chuck Lever, Jeff Layton,
Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-nfs, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
To make it self-documenting, the referenced commit added the space
for the null terminator as sizeof('\0'). The message elaborates on
why only one byte is needed, so this is clearly a mistake.
Spell it as 1 /* NUL */ instead.
This is the only result for git grep "sizeof.'" in the tree.
Fixes: commit 1e360a60b24a ("SUNRPC: Address buffer overrun in
rpc_uaddr2sockaddr()")
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
net/sunrpc/addr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index d435bffc6199..c4ba342f6866 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -311,7 +311,7 @@ size_t rpc_uaddr2sockaddr(struct net *net, const char *uaddr,
const size_t uaddr_len, struct sockaddr *sap,
const size_t salen)
{
- char *c, buf[RPCBIND_MAXUADDRLEN + sizeof('\0')];
+ char *c, buf[RPCBIND_MAXUADDRLEN + 1 /* NUL */];
u8 portlo, porthi;
unsigned short port;
base-commit: 26aff849438cebcd05f1a647390c4aa700d5c0f1
--
2.39.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: sunrpc: sizeof('\0') is 4, not 1
2023-12-15 23:53 [PATCH] net: sunrpc: sizeof('\0') is 4, not 1 Ahelenia Ziemiańska
@ 2023-12-16 4:27 ` NeilBrown
2023-12-16 5:43 ` Ahelenia Ziemiańska
0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2023-12-16 4:27 UTC (permalink / raw)
To: Ahelenia Ziemiańska
Cc: Trond Myklebust, Anna Schumaker, Chuck Lever, Jeff Layton,
Olga Kornievskaia, Dai Ngo, Tom Talpey, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-nfs, netdev,
linux-kernel
On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> To make it self-documenting, the referenced commit added the space
> for the null terminator as sizeof('\0'). The message elaborates on
> why only one byte is needed, so this is clearly a mistake.
> Spell it as 1 /* NUL */ instead.
>
> This is the only result for git grep "sizeof.'" in the tree.
>
> Fixes: commit 1e360a60b24a ("SUNRPC: Address buffer overrun in
> rpc_uaddr2sockaddr()")
It isn't clear to me that "Fixes" is appropriate as that patch isn't
harmful, just confused and sub-optimal.
But it probably doesn't mattter.
Reviewed-by: NeilBrown <neilb@suse.de>
Thanks,
NeilBrown
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
> ---
> net/sunrpc/addr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
> index d435bffc6199..c4ba342f6866 100644
> --- a/net/sunrpc/addr.c
> +++ b/net/sunrpc/addr.c
> @@ -311,7 +311,7 @@ size_t rpc_uaddr2sockaddr(struct net *net, const char *uaddr,
> const size_t uaddr_len, struct sockaddr *sap,
> const size_t salen)
> {
> - char *c, buf[RPCBIND_MAXUADDRLEN + sizeof('\0')];
> + char *c, buf[RPCBIND_MAXUADDRLEN + 1 /* NUL */];
> u8 portlo, porthi;
> unsigned short port;
>
>
> base-commit: 26aff849438cebcd05f1a647390c4aa700d5c0f1
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: sunrpc: sizeof('\0') is 4, not 1
2023-12-16 4:27 ` NeilBrown
@ 2023-12-16 5:43 ` Ahelenia Ziemiańska
2023-12-16 5:53 ` NeilBrown
0 siblings, 1 reply; 5+ messages in thread
From: Ahelenia Ziemiańska @ 2023-12-16 5:43 UTC (permalink / raw)
To: NeilBrown
Cc: Trond Myklebust, Anna Schumaker, Chuck Lever, Jeff Layton,
Olga Kornievskaia, Dai Ngo, Tom Talpey, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-nfs, netdev,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 735 bytes --]
On Sat, Dec 16, 2023 at 03:27:16PM +1100, NeilBrown wrote:
> On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> > To make it self-documenting, the referenced commit added the space
> > for the null terminator as sizeof('\0'). The message elaborates on
> > why only one byte is needed, so this is clearly a mistake.
> > Spell it as 1 /* NUL */ instead.
> >
> > Fixes: commit 1e360a60b24a ("SUNRPC: Address buffer overrun in
> > rpc_uaddr2sockaddr()")
> It isn't clear to me that "Fixes" is appropriate as that patch isn't
> harmful, just confused and sub-optimal.
I definitely agree, I don't like Fixes here at all,
but I don't really see another trailer in the documentation
or in the log that could be used for this.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: sunrpc: sizeof('\0') is 4, not 1
2023-12-16 5:43 ` Ahelenia Ziemiańska
@ 2023-12-16 5:53 ` NeilBrown
2023-12-16 16:45 ` Chuck Lever
0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2023-12-16 5:53 UTC (permalink / raw)
To: Ahelenia Ziemiańska
Cc: Trond Myklebust, Anna Schumaker, Chuck Lever, Jeff Layton,
Olga Kornievskaia, Dai Ngo, Tom Talpey, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-nfs, netdev,
linux-kernel
On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> On Sat, Dec 16, 2023 at 03:27:16PM +1100, NeilBrown wrote:
> > On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> > > To make it self-documenting, the referenced commit added the space
> > > for the null terminator as sizeof('\0'). The message elaborates on
> > > why only one byte is needed, so this is clearly a mistake.
> > > Spell it as 1 /* NUL */ instead.
> > >
> > > Fixes: commit 1e360a60b24a ("SUNRPC: Address buffer overrun in
> > > rpc_uaddr2sockaddr()")
> > It isn't clear to me that "Fixes" is appropriate as that patch isn't
> > harmful, just confused and sub-optimal.
> I definitely agree, I don't like Fixes here at all,
> but I don't really see another trailer in the documentation
> or in the log that could be used for this.
>
Make up a new Trailer?
I would probably just write
To make it self-documenting,
commit 1e360a60b24a ("SUNRPC: Address buffer overrun in rpc_uaddr2sockaddr()")
added the space for the null terminator as sizeof('\0') which is 4. The commit
elaborates on why only one byte is needed, so this is clearly a mistake.
Spell it as 1 /* NUL */ instead.
NeilBrown
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: sunrpc: sizeof('\0') is 4, not 1
2023-12-16 5:53 ` NeilBrown
@ 2023-12-16 16:45 ` Chuck Lever
0 siblings, 0 replies; 5+ messages in thread
From: Chuck Lever @ 2023-12-16 16:45 UTC (permalink / raw)
To: Ahelenia Ziemiańska
Cc: Trond Myklebust, Anna Schumaker, Jeff Layton, Olga Kornievskaia,
Dai Ngo, Tom Talpey, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-nfs, netdev, linux-kernel
On Sat, Dec 16, 2023 at 04:53:23PM +1100, NeilBrown wrote:
> On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> > On Sat, Dec 16, 2023 at 03:27:16PM +1100, NeilBrown wrote:
> > > On Sat, 16 Dec 2023, Ahelenia Ziemiańska wrote:
> > > > To make it self-documenting, the referenced commit added the space
> > > > for the null terminator as sizeof('\0'). The message elaborates on
> > > > why only one byte is needed, so this is clearly a mistake.
> > > > Spell it as 1 /* NUL */ instead.
> > > >
> > > > Fixes: commit 1e360a60b24a ("SUNRPC: Address buffer overrun in
> > > > rpc_uaddr2sockaddr()")
> > > It isn't clear to me that "Fixes" is appropriate as that patch isn't
> > > harmful, just confused and sub-optimal.
> > I definitely agree, I don't like Fixes here at all,
> > but I don't really see another trailer in the documentation
> > or in the log that could be used for this.
> >
>
> Make up a new Trailer?
>
> I would probably just write
>
> To make it self-documenting,
> commit 1e360a60b24a ("SUNRPC: Address buffer overrun in rpc_uaddr2sockaddr()")
> added the space for the null terminator as sizeof('\0') which is 4. The commit
> elaborates on why only one byte is needed, so this is clearly a mistake.
> Spell it as 1 /* NUL */ instead.
Agreed; if Fixes: is overkill, simply spell out the commit that
introduced the issue in the patch description as Neil does here.
--
Chuck Lever
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-16 16:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-15 23:53 [PATCH] net: sunrpc: sizeof('\0') is 4, not 1 Ahelenia Ziemiańska
2023-12-16 4:27 ` NeilBrown
2023-12-16 5:43 ` Ahelenia Ziemiańska
2023-12-16 5:53 ` NeilBrown
2023-12-16 16:45 ` Chuck Lever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®