Skip to content

Commit

Permalink
mm/zswap.c: improve a size determination in zswap_frontswap_init()
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Markus Elfring <[email protected]>
Cc: Dan Streetman <[email protected]>
Cc: Seth Jennings <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
elfring authored and RahifM committed Jul 9, 2020
1 parent 0068be4 commit 61e7f0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/zswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ 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) {
pr_err("alloc failed, zswap disabled for swap type %d\n", type);
return;
Expand Down

0 comments on commit 61e7f0d

Please sign in to comment.