[PATCH 2/2] [media] dmxdev: Improve a size determination in dvb_dmxdev_add_pid()

From: SF Markus Elfring
Date: Tue Sep 26 2017 - 09:36:10 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Sep 2017 15:22:57 +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@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/media/dvb-core/dmxdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index f8bf7459d5ca..8e0f91775fe4 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -809,7 +809,7 @@ static int dvb_dmxdev_add_pid(struct dmxdev *dmxdev,
(!list_empty(&filter->feed.ts)))
return -EINVAL;

- feed = kzalloc(sizeof(struct dmxdev_feed), GFP_KERNEL);
+ feed = kzalloc(sizeof(*feed), GFP_KERNEL);
if (feed == NULL)
return -ENOMEM;

--
2.14.1