Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725550

[PATCH 2/3] [media] cx18: Improve a size determination in cx18_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/3] [media] cx18: Improve a size determination in cx18_probe()
Date 2017-09-02 20:50 +0200
Message-ID <ullEt-6tS-9@gated-at.bofh.it> (permalink)
References <ullEt-6tS-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Sep 2017 19:42:12 +0200

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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/pci/cx18/cx18-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index b267590e0877..49fc9b72ada5 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -909,5 +909,5 @@ static int cx18_probe(struct pci_dev *pci_dev,
 		return -ENOMEM;
 	}
 
-	cx = kzalloc(sizeof(struct cx18), GFP_ATOMIC);
+	cx = kzalloc(sizeof(*cx), GFP_ATOMIC);
 	if (!cx)
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] [media] cx18: Adjustments for seven function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 20:50 +0200
  [PATCH 1/3] [media] cx18: Delete an error message for a failed memory  allocation in cx18_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 20:50 +0200
  [PATCH 2/3] [media] cx18: Improve a size determination in  cx18_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-02 20:50 +0200

csiph-web