linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Replace kmalloc with kmalloc_array
@ 2016-12-08  5:13 Architha Chitukuri
  0 siblings, 0 replies; 2+ messages in thread
From: Architha Chitukuri @ 2016-12-08  5:13 UTC (permalink / raw)
  To: Dmitri Torokhov, Architha Chitukuri
  Cc: linux-input, vidushi.koul, archithachitukuri

From: "a.chitukuri" <a.chitukuri@samsung.com>

Replace kmalloc with a more specific function kmalloc_array
when allocated memory size is a multiplication of: NUMBER*SIZE


Signed-off-by: a.chitukuri <a.chitukuri@samsung.com>
---
 drivers/input/joystick/joydump.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/joystick/joydump.c b/drivers/input/joystick/joydump.c
index d1c6e48..7f4dff9 100644
--- a/drivers/input/joystick/joydump.c
+++ b/drivers/input/joystick/joydump.c
@@ -80,7 +80,7 @@ static int joydump_connect(struct gameport *gameport, struct gameport_driver *dr
 
 	timeout = gameport_time(gameport, 10000); /* 10 ms */
 
-	buf = kmalloc(BUF_SIZE * sizeof(struct joydump), GFP_KERNEL);
+	buf = kmalloc_array(BUF_SIZE, sizeof(struct joydump), GFP_KERNEL);
 	if (!buf) {
 		printk(KERN_INFO "joydump: no memory for testing\n");
 		goto jd_end;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-08  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20161201045030epcms5p580ae66d224e33919a1b7e2afc6d8ae94@epcms5p5>
     [not found] ` <20161201045030epcms5p580ae66d224e33919a1b7e2afc6d8ae94@epcms5p5>
2016-12-03 18:49   ` [PATCH] Replace kmalloc with kmalloc_array dmitry.torokhov
2016-12-08  5:13 Architha Chitukuri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).