[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c4ef401-9777-4a00-9b1f-0c66650a826d@linux.ibm.com>
Date: Wed, 22 Jan 2025 15:46:16 +0100
From: Alexandra Winter <wintera@...ux.ibm.com>
To: Simon Horman <horms@...nel.org>
Cc: Wenjia Zhang <wenjia@...ux.ibm.com>, Jan Karcher <jaka@...ux.ibm.com>,
Gerd Bayer <gbayer@...ux.ibm.com>, Halil Pasic <pasic@...ux.ibm.com>,
"D. Wythe" <alibuda@...ux.alibaba.com>,
Tony Lu <tonylu@...ux.alibaba.com>, Wen Gu <guwen@...ux.alibaba.com>,
Peter Oberparleiter
<oberpar@...ux.ibm.com>,
David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Julian Ruess <julianr@...ux.ibm.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Thorsten Winkler <twinkler@...ux.ibm.com>, netdev@...r.kernel.org,
linux-s390@...r.kernel.org, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev
<agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>
Subject: Re: [RFC net-next 3/7] net/ism: Use uuid_t for ISM GID
On 20.01.25 18:18, Simon Horman wrote:
>> +static inline void copy_to_smcdgid(struct smcd_gid *sgid, uuid_t *igid)
>> +{
>> + __be64 temp;
>> +
>> + memcpy(&temp, igid, sizeof(sgid->gid));
>> + sgid->gid = ntohll(temp);
>> + memcpy(&temp, igid + sizeof(sgid->gid), sizeof(sgid->gid_ext));
> Hi Alexandra,
>
> The stride of the pointer arithmetic is the width of igid
> so this write will be at an offset of:
>
> sizeof(igid) + sizeof(sgid->gid) = 128 bytes
>
> Which is beyond the end of *igid.
Duh, what a stupid mistake. Thank you.
> I think the desired operation is to write at an offset of 8 bytes, so
> perhaps this is a way to achieve that, as the bi field is a
> 16 byte array of u8:
>
> memcpy(&temp, igid->b + sizeof(sgid->gid), sizeof(sgid->gid_ext));
I propose to keep the
memcpy(&temp, (u8 *)igid + sizeof(sgid->gid), sizeof(sgid->gid_ext));
like in the orginal net/smc/smc_loopback.c
> Flagged by W=1 builds with gcc-14 and clang-19, and by Smatch.
>
>> + sgid->gid_ext = ntohll(temp);
>> +}
I actually overlooked it in my smatch run (too many old warnings), but I
cannot get W=1 to flag it. I'll try to improve my setup.
Powered by blists - more mailing lists