lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1203012256520.19443@swampdragon.chaosbits.net>
Date:	Thu, 1 Mar 2012 23:01:19 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	linux-usb@...r.kernel.org
cc:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Felipe Balbi <balbi@...com>,
	Ben Williamson <ben.williamson@...yinnovation.com>,
	Bryan Wu <cooloney@...nel.org>, Daniel Mack <zonque@...il.com>
Subject: [PATCH] Allocate correct size (portably) in
 drivers/usb/gadget/f_midi.c::f_midi_bind()

As the coverity checker puts it:

"Passing argument "sizeof (midi_function) /*8*/" to function "kcalloc"
and then casting the return value to "struct usb_descriptor_header **"
is suspicious. ... In this particular case sizeof(struct
usb_descriptor_header **) happens to be equal to sizeof(struct
usb_descriptor_header *), but this is not a portable assumption."

I believe we really do intend to use 'sizeof(*midi_function)' here, so
this patch makes that change.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/usb/gadget/f_midi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index 3797b3d..2f7e8f2 100644
--- a/drivers/usb/gadget/f_midi.c
+++ b/drivers/usb/gadget/f_midi.c
@@ -780,7 +780,7 @@ f_midi_bind(struct usb_configuration *c, struct usb_function *f)
 	midi->out_ep->driver_data = cdev;	/* claim */
 
 	/* allocate temporary function list */
-	midi_function = kcalloc((MAX_PORTS * 4) + 9, sizeof(midi_function),
+	midi_function = kcalloc((MAX_PORTS * 4) + 9, sizeof(*midi_function),
 				GFP_KERNEL);
 	if (!midi_function) {
 		status = -ENOMEM;
-- 
1.7.9.2


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ