Commit 14fc2a0
myri10ge: avoid uninitialized variable use
[ Upstream commit fd24173 ]
While compile testing on less common architectures, I noticed that gcc-10 on
s390 finds a bug that all other configurations seem to miss:
drivers/net/ethernet/myricom/myri10ge/myri10ge.c: In function 'myri10ge_set_multicast_list':
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:391:25: error: 'cmd.data0' is used uninitialized in this function [-Werror=uninitialized]
391 | buf->data0 = htonl(data->data0);
| ^~
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:392:25: error: '*((void *)&cmd+4)' is used uninitialized in this function [-Werror=uninitialized]
392 | buf->data1 = htonl(data->data1);
| ^~
drivers/net/ethernet/myricom/myri10ge/myri10ge.c: In function 'myri10ge_allocate_rings':
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:392:13: error: 'cmd.data1' is used uninitialized in this function [-Werror=uninitialized]
392 | buf->data1 = htonl(data->data1);
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:1939:22: note: 'cmd.data1' was declared here
1939 | struct myri10ge_cmd cmd;
| ^~~
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:393:13: error: 'cmd.data2' is used uninitialized in this function [-Werror=uninitialized]
393 | buf->data2 = htonl(data->data2);
drivers/net/ethernet/myricom/myri10ge/myri10ge.c:1939:22: note: 'cmd.data2' was declared here
1939 | struct myri10ge_cmd cmd;
It would be nice to understand how to make other compilers catch this as
well, but for the moment I'll just shut up the warning by fixing the
undefined behavior in this driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260205162935.2126442-1-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent cf39060 commit 14fc2a0
1 file changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
691 | 694 | | |
692 | 695 | | |
693 | 696 | | |
| |||
806 | 809 | | |
807 | 810 | | |
808 | 811 | | |
| 812 | + | |
809 | 813 | | |
810 | 814 | | |
811 | 815 | | |
| |||
817 | 821 | | |
818 | 822 | | |
819 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
820 | 827 | | |
821 | 828 | | |
822 | 829 | | |
| |||
834 | 841 | | |
835 | 842 | | |
836 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
837 | 847 | | |
838 | 848 | | |
839 | 849 | | |
| |||
1946 | 1956 | | |
1947 | 1957 | | |
1948 | 1958 | | |
| 1959 | + | |
| 1960 | + | |
1949 | 1961 | | |
1950 | 1962 | | |
1951 | 1963 | | |
| |||
2238 | 2250 | | |
2239 | 2251 | | |
2240 | 2252 | | |
| 2253 | + | |
| 2254 | + | |
2241 | 2255 | | |
2242 | 2256 | | |
2243 | 2257 | | |
2244 | 2258 | | |
2245 | 2259 | | |
2246 | 2260 | | |
| 2261 | + | |
| 2262 | + | |
2247 | 2263 | | |
2248 | 2264 | | |
2249 | 2265 | | |
| |||
2312 | 2328 | | |
2313 | 2329 | | |
2314 | 2330 | | |
| 2331 | + | |
2315 | 2332 | | |
2316 | 2333 | | |
2317 | 2334 | | |
| |||
2414 | 2431 | | |
2415 | 2432 | | |
2416 | 2433 | | |
| 2434 | + | |
| 2435 | + | |
2417 | 2436 | | |
2418 | 2437 | | |
2419 | 2438 | | |
| |||
2472 | 2491 | | |
2473 | 2492 | | |
2474 | 2493 | | |
2475 | | - | |
2476 | 2494 | | |
2477 | 2495 | | |
2478 | 2496 | | |
| |||
2491 | 2509 | | |
2492 | 2510 | | |
2493 | 2511 | | |
| 2512 | + | |
| 2513 | + | |
2494 | 2514 | | |
2495 | 2515 | | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
2496 | 2519 | | |
2497 | 2520 | | |
2498 | 2521 | | |
| |||
2956 | 2979 | | |
2957 | 2980 | | |
2958 | 2981 | | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
2959 | 2985 | | |
2960 | 2986 | | |
2961 | 2987 | | |
| |||
0 commit comments