All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc
@ 2016-02-09 21:00 Janani Ravichandran
  2016-02-09 16:05 ` [Outreachy kernel] " Julia Lawall
  2016-02-09 16:23 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-09 21:00 UTC (permalink / raw)
  To: outreachy-kernel

Use kcalloc rather than kzalloc when multiplied with size to prevent
integer overflows. This change also makes code nicer to read.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
---
Changes since v2:
 * Moved GFP_KERNEL to the previous line as it fits there.

 drivers/staging/rdma/hfi1/efivar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
index b8711f3..e569f9f 100644
--- a/drivers/staging/rdma/hfi1/efivar.c
+++ b/drivers/staging/rdma/hfi1/efivar.c
@@ -83,8 +83,7 @@ static int read_efi_var(const char *name, unsigned long *size,
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -EOPNOTSUPP;
 
-	uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t),
-			   GFP_KERNEL);
+	uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t), GFP_KERNEL);
 	temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL);
 
 	if (!uni_name || !temp_buffer) {
-- 
2.5.0



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

end of thread, other threads:[~2016-02-09 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 21:00 [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc Janani Ravichandran
2016-02-09 16:05 ` [Outreachy kernel] " Julia Lawall
2016-02-09 16:23 ` Greg KH
2016-02-09 16:34   ` Janani Ravichandran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.