lkml.org 
[lkml]   [2019]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] nvmet-fc: use zero-sized array and struct_size() in kzalloc()
From
Date
On Sat, 2019-02-23 at 12:51 -0600, Gustavo A. R. Silva wrote:
> Update the code to use a zero-sized array instead of a pointer in
> structure nvmet_fc_tgt_queue and use struct_size() in kzalloc().
[]
> This code was detected with the help of Coccinelle.

Really?
Impressive script that found this one.

> diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
[]
> @@ -128,12 +128,12 @@ struct nvmet_fc_tgt_queue {
> struct nvmet_cq nvme_cq;
> struct nvmet_sq nvme_sq;
> struct nvmet_fc_tgt_assoc *assoc;
> - struct nvmet_fc_fcp_iod *fod; /* array of fcp_iods */
> struct list_head fod_list;
> struct list_head pending_cmd_list;
> struct list_head avail_defer_list;
> struct workqueue_struct *work_q;
> struct kref ref;
> + struct nvmet_fc_fcp_iod fod[]; /* array of fcp_iods */
> } __aligned(sizeof(unsigned long long));

Moving a pointer from the middle of a struct to
the end seems unusual for coccinelle.


\
 
 \ /
  Last update: 2019-02-23 21:07    [W:0.113 / U:12.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site