All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Jonathan Sims <jonathan.625266@earthlink.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] [media] hdpvr: Improve a size determination in hdpvr_alloc_buffers()
Date: Tue, 19 Sep 2017 18:46:30 +0000	[thread overview]
Message-ID: <b586b33a-e305-8592-bc3e-fe337e05a39a@users.sourceforge.net> (raw)
In-Reply-To: <82d14066-5816-111c-9d21-f6a439e559c1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 19 Sep 2017 19:27:53 +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/usb/hdpvr/hdpvr-video.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index 657d910dfa1d..f06efcd70c14 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -145,6 +145,5 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count)
 		 "allocating %u buffers\n", count);
 
 	for (i = 0; i < count; i++) {
-
-		buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL);
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 		if (!buf)
-- 
2.14.1


WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Jonathan Sims <jonathan.625266@earthlink.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] [media] hdpvr: Improve a size determination in hdpvr_alloc_buffers()
Date: Tue, 19 Sep 2017 20:46:30 +0200	[thread overview]
Message-ID: <b586b33a-e305-8592-bc3e-fe337e05a39a@users.sourceforge.net> (raw)
In-Reply-To: <82d14066-5816-111c-9d21-f6a439e559c1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 19 Sep 2017 19:27:53 +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/usb/hdpvr/hdpvr-video.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index 657d910dfa1d..f06efcd70c14 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -145,6 +145,5 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count)
 		 "allocating %u buffers\n", count);
 
 	for (i = 0; i < count; i++) {
-
-		buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL);
+		buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 		if (!buf)
-- 
2.14.1

  parent reply	other threads:[~2017-09-19 18:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 18:44 [PATCH 0/3] [media] HD PVR USB: Adjustments for two function implementations SF Markus Elfring
2017-09-19 18:44 ` SF Markus Elfring
2017-09-19 18:45 ` [PATCH 1/3] [media] hdpvr: Delete three error messages for a failed memory allocation SF Markus Elfring
2017-09-19 18:45   ` SF Markus Elfring
2017-09-19 18:46 ` SF Markus Elfring [this message]
2017-09-19 18:46   ` [PATCH 2/3] [media] hdpvr: Improve a size determination in hdpvr_alloc_buffers() SF Markus Elfring
2017-09-19 18:47 ` [PATCH 3/3] [media] hdpvr: Return an error code only as a constant " SF Markus Elfring
2017-09-19 18:47   ` SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b586b33a-e305-8592-bc3e-fe337e05a39a@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=akpm@linux-foundation.org \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonathan.625266@earthlink.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.