Skip to content

Commit 325694e

Browse files
chelsiocudbgdavem330
authored andcommitted
cxgb4: properly initialize variables
memset variables to 0 to fix sparse warnings: drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c:409:42: sparse: Using plain integer as NULL pointer drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c:43:47: sparse: Using plain integer as NULL pointer Fixes: ad75b7d ("cxgb4: implement ethtool dump data operations") Fixes: 91c1953 ("cxgb4: use zlib deflate to compress firmware dump") Signed-off-by: Rahul Lakkireddy <[email protected]> Signed-off-by: Ganesh Goudar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a1cf9c9 commit 325694e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ int cudbg_compress_buff(struct cudbg_init *pdbg_init,
4040
struct cudbg_buffer *pin_buff,
4141
struct cudbg_buffer *pout_buff)
4242
{
43-
struct z_stream_s compress_stream = { 0 };
4443
struct cudbg_buffer temp_buff = { 0 };
44+
struct z_stream_s compress_stream;
4545
struct cudbg_compress_hdr *c_hdr;
4646
int rc;
4747

@@ -53,6 +53,7 @@ int cudbg_compress_buff(struct cudbg_init *pdbg_init,
5353
c_hdr = (struct cudbg_compress_hdr *)temp_buff.data;
5454
c_hdr->compress_id = CUDBG_ZLIB_COMPRESS_ID;
5555

56+
memset(&compress_stream, 0, sizeof(struct z_stream_s));
5657
compress_stream.workspace = pdbg_init->workspace;
5758
rc = zlib_deflateInit2(&compress_stream, Z_DEFAULT_COMPRESSION,
5859
Z_DEFLATED, CUDBG_ZLIB_WIN_BITS,

drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,15 @@ static void cudbg_free_compress_buff(struct cudbg_init *pdbg_init)
406406
int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size,
407407
u32 flag)
408408
{
409-
struct cudbg_init cudbg_init = { 0 };
410409
struct cudbg_buffer dbg_buff = { 0 };
411410
u32 size, min_size, total_size = 0;
411+
struct cudbg_init cudbg_init;
412412
struct cudbg_hdr *cudbg_hdr;
413413
int rc;
414414

415415
size = *buf_size;
416416

417+
memset(&cudbg_init, 0, sizeof(struct cudbg_init));
417418
cudbg_init.adap = adap;
418419
cudbg_init.outbuf = buf;
419420
cudbg_init.outbuf_size = size;

0 commit comments

Comments
 (0)