[alsa-devel] sound/pci/au88x0/au88x0_core.c: many calls to memset with not-plausible size ?
Hello there,
sound/pci/au88x0/au88x0_core.c:2153:6: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
Source code is
memset(stream->resources, 0, sizeof(unsigned char) * VORTEX_RESOURCE_LAST);
but
sound/pci/au88x0/au88x0.h: u32 resources[5];
Something like
memset(stream->resources, 0, sizeof(stream->resources[0]) * VORTEX_RESOURCE_LAST);
Some duplicates:
sound/pci/au88x0/au88x0_core.c:2163:7: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2177:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2292:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2301:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
Regards
David Binderman
On Mon, 02 May 2016 16:43:15 +0200, David Binderman wrote:
Hello there,
sound/pci/au88x0/au88x0_core.c:2153:6: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
Source code is
memset(stream->resources, 0, sizeof(unsigned char) * VORTEX_RESOURCE_LAST);
but
sound/pci/au88x0/au88x0.h: u32 resources[5];
Something like
memset(stream->resources, 0, sizeof(stream->resources[0]) * VORTEX_RESOURCE_LAST);
Some duplicates:
sound/pci/au88x0/au88x0_core.c:2163:7: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2177:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2292:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] sound/pci/au88x0/au88x0_core.c:2301:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
Yes, indeed these look wrong. But the simplest fix is just to write like memset(stream->resources, 0, sizeof(stream->resources));
Care to send a fix patch?
thanks,
Takashi
Hello there,
----------------------------------------
Yes, indeed these look wrong. But the simplest fix is just to write like memset(stream->resources, 0, sizeof(stream->resources));
Care to send a fix patch?
Thanks for your offer, but not possible from this account. I am happy for someone else to provide one.
Regards
David Binderman
participants (2)
-
David Binderman
-
Takashi Iwai