[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180704173153.GA34386@beast>
Date: Wed, 4 Jul 2018 10:31:53 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: AKASHI Takahiro <takahiro.akashi@...aro.org>,
Baoquan He <bhe@...hat.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-kernel@...r.kernel.org
Subject: [PATCH] resource: Use 2-factor allocator calls
As already done treewide, switch from open-coded multiplication to using
2-factor allocation helpers.
Signed-off-by: Kees Cook <keescook@...omium.org>
---
kernel/resource.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index d717acd12bf4..16debbf2d24c 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -453,7 +453,7 @@ int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
int ret = -1;
/* create a list */
- rams = vmalloc(sizeof(struct resource) * rams_size);
+ rams = vmalloc(array_size(rams_size, sizeof(struct resource)));
if (!rams)
return ret;
@@ -469,8 +469,8 @@ int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
int rams_new_size;
rams_new_size = rams_size + 16;
- rams_new = vmalloc(sizeof(struct resource)
- * rams_new_size);
+ rams_new = vmalloc(array_size(rams_new_size,
+ sizeof(struct resource)));
if (!rams_new)
goto out;
--
2.17.1
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists