mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-pcmcia@lists.infradead.org
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/4] pcmcia: pd6729: Use kcalloc() in pd6729_pci_probe()
Date: Mon, 15 May 2017 14:26:39 +0200	[thread overview]
Message-ID: <efe4fbad-19da-55ba-678f-eb325e060dc9@users.sourceforge.net> (raw)
In-Reply-To: <07cd817c-3045-72d8-34e2-e81b73efc291@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 11:41:00 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus reuse the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data structure by a pointer dereference
  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>
---
 drivers/pcmcia/pd6729.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 0f70b4d58f9e..289a5e74e852 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -628,6 +628,5 @@ static int pd6729_pci_probe(struct pci_dev *dev,
 	char configbyte;
 	struct pd6729_socket *socket;
 
-	socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
-			 GFP_KERNEL);
+	socket = kcalloc(MAX_SOCKETS, sizeof(*socket), GFP_KERNEL);
 	if (!socket) {
-- 
2.13.0

  reply	other threads:[~2017-05-15 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 12:25 [PATCH 0/4] PCMCIA-PD6729: Adjustments for four function implementations SF Markus Elfring
2017-05-15 12:26 ` SF Markus Elfring [this message]
2017-05-15 12:27 ` [PATCH 2/4] pcmcia: pd6729: Delete an error message for a failed memory allocation in pd6729_pci_probe() SF Markus Elfring
2017-05-15 12:29 ` [PATCH 3/4] pcmcia: pd6729: Add the macro "pr_fmt" SF Markus Elfring
2017-05-15 12:30 ` [PATCH 4/4] pcmcia: pd6729: Combine substrings for six messages 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=efe4fbad-19da-55ba-678f-eb325e060dc9@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome