linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-mm@kvack.org, Dan Streetman <ddstreet@ieee.org>,
	Seth Jennings <sjenning@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] zswap: Improve a size determination in zswap_frontswap_init()
Date: Sun, 21 May 2017 10:26:22 +0200	[thread overview]
Message-ID: <19f9da22-092b-f867-bdf6-f4dbad7ccf1f@users.sourceforge.net> (raw)
In-Reply-To: <05101843-91f6-3243-18ea-acac8e8ef6af@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 20 May 2017 22:44:03 +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.

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

diff --git a/mm/zswap.c b/mm/zswap.c
index 18d8e87119a6..a6e67633be03 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1156,5 +1156,5 @@ static void zswap_frontswap_init(unsigned type)
 {
 	struct zswap_tree *tree;
 
-	tree = kzalloc(sizeof(struct zswap_tree), GFP_KERNEL);
+	tree = kzalloc(sizeof(*tree), GFP_KERNEL);
 	if (!tree) {
-- 
2.13.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2017-05-21  8:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21  8:23 [PATCH 0/3] zswap: Adjustments for three function implementations SF Markus Elfring
2017-05-21  8:25 ` [PATCH 1/3] zswap: Delete an error message for a failed memory allocation in zswap_pool_create() SF Markus Elfring
2017-05-30 23:18   ` Dan Streetman
2017-05-21  8:26 ` SF Markus Elfring [this message]
2017-05-30 23:19   ` [PATCH 2/3] zswap: Improve a size determination in zswap_frontswap_init() Dan Streetman
2017-05-21  8:27 ` [PATCH 3/3] zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare() SF Markus Elfring
2017-05-21  8:47   ` Wolfram Sang
2017-05-21  9:40     ` SF Markus Elfring
2017-05-21  9:56       ` Wolfram Sang
2017-05-21 10:12         ` Using best practices for big software change possibilities SF Markus Elfring
2017-05-21 10:27           ` Wolfram Sang
2017-05-21 10:45             ` SF Markus Elfring
2017-05-30 23:20   ` [PATCH 3/3] zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare() Dan Streetman

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=19f9da22-092b-f867-bdf6-f4dbad7ccf1f@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=ddstreet@ieee.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).