public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: mlindner@marvell.com, stephen@networkplumber.org, mst@redhat.com,
	jasowang@redhat.com
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	Stephen Hemminger <sthemmin@microsoft.com>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH net-next 1/4] tun/tap: use paren's with sizeof
Date: Tue, 15 Aug 2017 10:29:16 -0700	[thread overview]
Message-ID: <20170815172919.26153-2-sthemmin@microsoft.com> (raw)
In-Reply-To: <20170815172919.26153-1-sthemmin@microsoft.com>

Although sizeof is an operator in C. The kernel coding style convention
is to always use it like a function and add parenthesis.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap.c | 2 +-
 drivers/net/tun.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 0d039411e64c..21b71ae947fd 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -1215,7 +1215,7 @@ int tap_queue_resize(struct tap_dev *tap)
 	int n = tap->numqueues;
 	int ret, i = 0;
 
-	arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL);
+	arrays = kmalloc_array(n, sizeof(*arrays), GFP_KERNEL);
 	if (!arrays)
 		return -ENOMEM;
 
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 5892284eb8d0..f5017121cd57 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2737,7 +2737,7 @@ static int tun_queue_resize(struct tun_struct *tun)
 	int n = tun->numqueues + tun->numdisabled;
 	int ret, i;
 
-	arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL);
+	arrays = kmalloc_array(n, sizeof(*arrays), GFP_KERNEL);
 	if (!arrays)
 		return -ENOMEM;
 
-- 
2.11.0

  reply	other threads:[~2017-08-15 17:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 17:29 [PATCH net-next 0/4] various sizeof cleanups Stephen Hemminger
2017-08-15 17:29 ` Stephen Hemminger [this message]
2017-08-15 17:29 ` [PATCH net-next 2/4] virtio: put paren around sizeof Stephen Hemminger
2017-08-15 17:29 ` [PATCH net-next 3/4] skge: add paren around sizeof arg Stephen Hemminger
2017-08-15 17:29 ` [PATCH net-next 4/4] mlx4: sizeof style usage Stephen Hemminger
     [not found]   ` <20170815172919.26153-5-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
2017-08-15 18:13     ` Leon Romanovsky
2017-08-20 10:27   ` Tariq Toukan
2017-08-20 18:00     ` Stephen Hemminger
     [not found]       ` <DM2PR21MB0074E2B2C697B1300B77EFEACC860-B2pw06WL+/BdZnmuHZ3GOs1VXTxX1y3OvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-08-21 10:53         ` Tariq Toukan
2017-08-15 19:47 ` [PATCH net-next 0/4] various sizeof cleanups Michael S. Tsirkin
     [not found] ` <20170815172919.26153-1-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
2017-08-16 18:02   ` David Miller

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=20170815172919.26153-2-sthemmin@microsoft.com \
    --to=stephen@networkplumber.org \
    --cc=jasowang@redhat.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mlindner@marvell.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=virtualization@lists.linux-foundation.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