瀏覽代碼

mm/zswap.c: improve a size determination in zswap_frontswap_init()

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.

Link: http://lkml.kernel.org/r/19f9da22-092b-f867-bdf6-f4dbad7ccf1f@users.sourceforge.net
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Markus Elfring 8 年之前
父節點
當前提交
9cd1f701ce
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mm/zswap.c

+ 1 - 1
mm/zswap.c

@@ -1156,7 +1156,7 @@ static void zswap_frontswap_init(unsigned type)
 {
 {
 	struct zswap_tree *tree;
 	struct zswap_tree *tree;
 
 
-	tree = kzalloc(sizeof(struct zswap_tree), GFP_KERNEL);
+	tree = kzalloc(sizeof(*tree), GFP_KERNEL);
 	if (!tree) {
 	if (!tree) {
 		pr_err("alloc failed, zswap disabled for swap type %d\n", type);
 		pr_err("alloc failed, zswap disabled for swap type %d\n", type);
 		return;
 		return;