Skip to contentSkip to conversation

Edwin Török found the following, so fix it

PATCH In review Alan Cox 3 participants 3 messages Nov 26, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 Edwin Török found the following, so fix it

In function ‘memset’,
inlined from ‘ir_input_init’ at drivers/media/common/ir-functions.c:67:
/home/edwin/builds/linux-2.6/arch/x86/include/asm/string_64.h:61:
warning: call to ‘__warn_memset_zero_len’ declared with attribute
warning: memset used with constant zero length parameter; this could be due to transposed parameters
memset(ir->ir_codes, sizeof(ir->ir_codes), 0);

In actual practice the only caller I can find happens to already have cleared the buffer before calling ir_input_init.

---

 drivers/media/common/ir-functions.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/ir-functions.c +1 -1
index 98b5125..fc2d894 100644
@@ -64,7 +64,7 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
 
 	ir->ir_type = ir_type;
 
-	memset(ir->ir_codes, sizeof(ir->ir_codes), 0);
+	memset(ir->ir_codes, 0, sizeof(ir->ir_codes));
 
 	/*
 	 * FIXME: This is a temporary workaround to use the new IR tables
#1 lore raw

Op 26-11-09 16:22, Alan Cox schreef:

Quoted 7 lines

In function ‘memset’,
inlined from ‘ir_input_init’ at drivers/media/common/ir-functions.c:67:
/home/edwin/builds/linux-2.6/arch/x86/include/asm/string_64.h:61:
warning: call to ‘__warn_memset_zero_len’ declared with attribute
warning: memset used with constant zero length parameter; this could be due to transposed parameters
memset(ir->ir_codes, sizeof(ir->ir_codes), 0);

Hello,
A "grep -E "memset.*,.*, 0\\)" -r" also reports drivers/staging/hv/StorVsc.c as a suspect:
memset(request, sizeof(struct storvsc_request_extension), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0);

Maybe someone cares about fixing it too?

Cheers,
Eric

#2 lore raw

Re: [PATCH] Edwin T??r??k found the following, so fix it

Quoted 16 lines · ??ric Piel

Op 26-11-09 16:22, Alan Cox schreef:

Quoted 7 lines

In function ???memset???,
inlined from ???ir_input_init??? at drivers/media/common/ir-functions.c:67:
/home/edwin/builds/linux-2.6/arch/x86/include/asm/string_64.h:61:
warning: call to ???__warn_memset_zero_len??? declared with attribute
warning: memset used with constant zero length parameter; this could be due to transposed parameters
memset(ir->ir_codes, sizeof(ir->ir_codes), 0);

Hello,
A "grep -E "memset.*,.*, 0\\)" -r" also reports drivers/staging/hv/StorVsc.c as a suspect:
memset(request, sizeof(struct storvsc_request_extension), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0); memset(vstorPacket, sizeof(struct vstor_packet), 0);

Quoted 1 line

Maybe someone cares about fixing it too?

It's already fixed in linux-next and will be sent to Linus soon.

thanks,

greg k-h