Skip to contentSkip to conversation

Staging: lustre: Use sizeof structure *pointer over sizeof structure in kzalloc().

PATCH In review Sandhya Bankar 2 participants 2 messages Sep 18, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: Use sizeof structure *pointer over sizeof structure in kzalloc().

This issue was found by checkpatch.

---
 drivers/staging/lustre/lustre/llite/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +1 -1
index 4965d15..5eed33a 100644
@@ -657,7 +657,7 @@ restart:
 
 			goto restart;
 		}
-		*och_p = kzalloc(sizeof(struct obd_client_handle), GFP_NOFS);
+		*och_p = kzalloc(sizeof(*och_p), GFP_NOFS);
 		if (!*och_p) {
 			rc = -ENOMEM;
 			goto out_och_free;
Signature · 1 line
1.7.1
#1 lore raw
Quoted 12 lines · Sandhya Bankar

This issue was found by checkpatch.

---
 drivers/staging/lustre/lustre/llite/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +0 -0
index 4965d15..5eed33a 100644

drivers/staging/lustre/lustre/llite/file.c restart: · line 660

Quoted 5 lines
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -657,7 +657,7 @@ restart:
 
 			goto restart;
 		}
-		*och_p = kzalloc(sizeof(struct obd_client_handle), GFP_NOFS);
+		*och_p = kzalloc(sizeof(*och_p), GFP_NOFS);

This doesn't look right. The declaration of och_p is:

struct obd_client_handle **och_p = NULL;

So sizeof(*och_p) is just the size of a pointer.

julia

Quoted 13 lines
drivers/staging/lustre/lustre/llite/file.c +0 -1
 		if (!*och_p) {
 			rc = -ENOMEM;
 			goto out_och_free;
--

1.7.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160918180816.GA4562%40sandhya.
For more options, visit https://groups.google.com/d/optout.