Re: broken 0 sized memset checks?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 5 Sep 2006, Dave Jones wrote:
>
> I ran sparse over the current linux kernel, and noticed this..
> 
> drivers/net/chelsio/sge.c:341:9: warning: memset with byte count of 0
> drivers/net/chelsio/sge.c:469:9: warning: memset with byte count of 0
> 
> The first..
> 
>         q->size = p->freelQ_size[i];
>         ....
>         size = sizeof(struct freelQ_ce) * q->size;
>         q->centries = kmalloc(size, GFP_KERNEL);
>         if (!q->centries)
>             goto err_no_mem;
>         memset(q->centries, 0, size);
>
> Sparse bug ?

I _suspect_ sparse has had some type-parsing bug, and thinks that 
"sizeof(struct freelQ_ce)" is zero for some reason, and then does all the 
constant folding (yeah, sparse is clever when it isn't really stupid ;), 
and that's what is going on.

I'll see if I can figure out what's up.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux