dma-buf: Improve a size determination in dma_buf_attach()
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 8 May 2017 08:50:09 +0000 (10:50 +0200)
committerSumit Semwal <sumit.semwal@linaro.org>
Mon, 8 May 2017 15:20:21 +0000 (20:50 +0530)
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
drivers/dma-buf/dma-buf.c

index 53257c166f4db736d724e8ae67cc63aad6d946ea..9887d72cf804e4efc0dd97108e88de55cb5f06f8 100644 (file)
@@ -558,7 +558,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
        if (WARN_ON(!dmabuf || !dev))
                return ERR_PTR(-EINVAL);
 
-       attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL);
+       attach = kzalloc(sizeof(*attach), GFP_KERNEL);
        if (attach == NULL)
                return ERR_PTR(-ENOMEM);