Skip to content

Commit 5d68fb7

Browse files
elfringNicholas Bellinger
authored andcommitted
target: Improve size determinations in two functions
Replace the specification of two data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determinations a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent fbc4040 commit 5d68fb7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/target/target_core_rd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int rd_attach_hba(struct se_hba *hba, u32 host_id)
4747
{
4848
struct rd_host *rd_host;
4949

50-
rd_host = kzalloc(sizeof(struct rd_host), GFP_KERNEL);
50+
rd_host = kzalloc(sizeof(*rd_host), GFP_KERNEL);
5151
if (!rd_host)
5252
return -ENOMEM;
5353

@@ -285,7 +285,7 @@ static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name)
285285
struct rd_dev *rd_dev;
286286
struct rd_host *rd_host = hba->hba_ptr;
287287

288-
rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL);
288+
rd_dev = kzalloc(sizeof(*rd_dev), GFP_KERNEL);
289289
if (!rd_dev)
290290
return NULL;
291291

0 commit comments

Comments
 (0)