Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by "Arnd Bergmann"
Tue, 10 Nov 2026 07:33
Re: [PATCH] myri10ge: correct uninitialized variable use
Author: "Arnd Bergmann"
Date: Tue, 10 Nov 2026 07:33
Date: Tue, 10 Nov 2026 07:33
50 lines
14573 bytes
14573 bytes
On Tue, Nov 10, 2026, at 00:57, Mark Nicholson wrote:
> Compiling using GCC 16.2.1, for aarch64, I see this error:
>
> In function '__const_memcpy_toio_aligned64',
> inlined from '__iowrite64_copy' at
> arch/arm64/include/asm/io.h:260:3,
> inlined from 'myri10ge_dummy_rdma' at
> drivers/net/ethernet/myricom/myri10ge/myri10ge.c:535:2:
> arch/arm64/include/asm/io.h:217:17: error: '*(const u64 *)(&buf[6])' is
> used uninitialized [-Werror=uninitialized]
> 217 | asm volatile("str %x0, [%8, #8 * 0]\n"
> | ^~~
> drivers/net/ethernet/myricom/myri10ge/myri10ge.c: In function
> 'myri10ge_dummy_rdma':
> drivers/net/ethernet/myricom/myri10ge/myri10ge.c:511:16: note: '*(const
> u64 *)(&buf[6])' was declared here
> 511 | __be32 buf[16] __attribute__ ((__aligned__(8)));
> | ^~~
>
> The correction seems to be straight-forward to silence/correct the issue. The
> additional change to the simplified `__aligned(8)` macro is suggested by
> `checkpatch`.
The patch looks technically correct, but I would suggest
improving it in two ways:
> static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
> {
> char __iomem *submit;
> - __be32 buf[16] __attribute__ ((__aligned__(8)));
> + __be32 buf[16] __aligned(8) = { 0 };
> u32 dma_low, dma_high;
> int i;
1. It is a bit confusing to initialize all 16 words
once and then initialize half of them again
a few lines down. For consistency, I would use
one style consistently, either everything in the
initialization, or everything individually as it
is done today.
2. You only fix the bug in myri10ge_dummy_rdma() and
myri10ge_load_firmware(), but the same problem
exists in myri10ge_send_cmd() in the same file
where the compiler missed it. Please check all
of the driver to see if the same pattern exists
elsewhere.
Arnd
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads