Message ID | 4zlmy3qwneijnrsbygfr2wbsnvdvcgvjyvudqnuxq5zvwmyaof@tarta.nabijaczleweli.xyz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9652488dys; Fri, 15 Dec 2023 15:54:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdeQgu7uiim+ZvIo0KbwY6ANKV89dsE2CG8uoTXDPbnlMgLCAmdNEL37ZTfFeLghm77jie X-Received: by 2002:ac8:5cc4:0:b0:425:4043:96d7 with SMTP id s4-20020ac85cc4000000b00425404396d7mr18042056qta.100.1702684453385; Fri, 15 Dec 2023 15:54:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702684453; cv=none; d=google.com; s=arc-20160816; b=rrW29R2wCbE4n0vcikjSnFVkcdLaSXY0/Ww+WIRs/tS+XP7uVMf9TdqAMQhx8t4CpA vZGoIV8UzKZVU3PAUCGBf8FDyFjCY8Sdr/aTiAwLqf2J9IeWnmePXXeaxNp0MwlI8dEI FHd71+srR+UCEJVG3Yj0cQYUHF+RVJHkEhaxfgztJ5SPo1xQQONOZVkUPeqFHb6Fs8tv NB9gM3Cr5l2eHtMKv+HP9W7neA60QWWVrNc4kN3/Npg6XBfbrNrJGoUC8hRQgd/wJtTz ewtCb+TFfcUHA8vSvyhPtFcxHH61niEbbLZ/gWLdbGYbAvspxC+81MaltxHDFwT43LBQ PDOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:from:date :dkim-signature; bh=/3xywNTqDGz5JgNkxxkUsLyvu7mGiu6kGnxN0V86kS0=; fh=vgcFi3s0gRMZ/IsDVDD1Jnz6m5I207/jOVuCJR4Mq5o=; b=VSnOv0kQm47QTtj3itCDXlZEgETtc4WFa1MeOWhbXJz4ZSzV1cDyTknqJHQQzORB1v vR+/SYS9JaN4iD1OiWKNzcinlBrk5IDKGFKE+eKBlXCilCTcpHFv5aKnBPxa49tTHa10 EGAMqwoqUrS8F5r9z0Ap7SC8TWiD3LXs38AdQVjVXXrINfUbpCPU6RTlItGvrG/5dFye Mzbcu5L3D7vvC5G0zgioilFedw5OPtkGvdZpB0pgIGh2xaIu1o1NThka2Jxxp3kBedOd CYVWT4KYUONKnLydSCELWRI09qHU1qCLCSdtAvIxQG/UYdsBPWWR3aSNVgn0tNO61+MN ZR2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=ALLplDil; spf=pass (google.com: domain of linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j20-20020ac874d4000000b0042370627853si16697941qtr.471.2023.12.15.15.54.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 15:54:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=ALLplDil; spf=pass (google.com: domain of linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D3541C24231 for <ouuuleilei@gmail.com>; Fri, 15 Dec 2023 23:54:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5048D48CE8; Fri, 15 Dec 2023 23:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nabijaczleweli.xyz header.i=@nabijaczleweli.xyz header.b="ALLplDil" X-Original-To: linux-kernel@vger.kernel.org Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EF6249F61; Fri, 15 Dec 2023 23:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nabijaczleweli.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nabijaczleweli.xyz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702684425; bh=Rp8yaDPkB4QdC5rV4rYLgAqrcv6iNuhHVPicafTNPjA=; h=Date:From:Cc:Subject:From; b=ALLplDilttu5v8rqxLa6CwJtIrwuJP315MxWVHc7kAmGUMtCESeRMxJJKx//uddqP YcCPENjMBMXJxfHq0jP8o+iUCLyH3eEAFrqTRwXk2l6ce658bdaGBGsnTAwEKA3e35 M1qGj+ioDQOY/FF6TwSy8BACJc46tKJQQGTXETuJYb42Q66j12hIWj/5HbySwik3Rq 1RAE5JsMOXMxZ70/mYf33JVw1C8rek5tApnMlnXPcz0C2nl7G3CHZ+Qay2cHiY4Km2 OuLbW5mgmoXiW+TgjgI2ZnYcCH3NDCgtAc3Tfd8g6AhgSLjdN+S2sEy7gawLVbOJJS zUIJ1Nc3AdEGA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id E14E3131E6; Sat, 16 Dec 2023 00:53:45 +0100 (CET) Date: Sat, 16 Dec 2023 00:53:45 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= <nabijaczleweli@nabijaczleweli.xyz> Cc: Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>, Olga Kornievskaia <kolga@netapp.com>, Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: sunrpc: sizeof('\0') is 4, not 1 Message-ID: <4zlmy3qwneijnrsbygfr2wbsnvdvcgvjyvudqnuxq5zvwmyaof@tarta.nabijaczleweli.xyz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pluqraly4f3xucjm" Content-Disposition: inline User-Agent: NeoMutt/20231103-116-3b855e-dirty X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785394052952391248 X-GMAIL-MSGID: 1785394052952391248 |
Series |
net: sunrpc: sizeof('\0') is 4, not 1
|
|
Commit Message
Ahelenia Ziemiańska
Dec. 15, 2023, 11:53 p.m. UTC
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(-)
base-commit: 26aff849438cebcd05f1a647390c4aa700d5c0f1
Comments
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 >
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.
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
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.
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;