[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200819172134.11243-4-nramas@linux.microsoft.com>
Date: Wed, 19 Aug 2020 10:21:32 -0700
From: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To: zohar@...ux.ibm.com, bauerman@...ux.ibm.com, robh@...nel.org,
gregkh@...uxfoundation.org, james.morse@....com,
catalin.marinas@....com, sashal@...nel.org, will@...nel.org,
mpe@...erman.id.au, benh@...nel.crashing.org, paulus@...ba.org,
robh+dt@...nel.org, frowand.list@...il.com,
vincenzo.frascino@....com, mark.rutland@....com,
dmitry.kasatkin@...il.com, jmorris@...ei.org, serge@...lyn.com,
pasha.tatashin@...een.com, allison@...utok.net,
kstewart@...uxfoundation.org, takahiro.akashi@...aro.org,
tglx@...utronix.de, masahiroy@...nel.org, bhsharma@...hat.com,
mbrugger@...e.com, hsinyi@...omium.org, tao.li@...o.com,
christophe.leroy@....fr
Cc: linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, prsriva@...ux.microsoft.com,
balajib@...ux.microsoft.com
Subject: [PATCH v4 3/5] IMA: Refactor do_get_kexec_buffer() to call of_ functions directly
do_get_kexec_buffer() calls another local function get_addr_size_cells()
to get the address and size of the IMA measurement log buffer stored in
the device tree. get_addr_size_cells() is small enough that it can be
merged into do_get_kexec_buffer() and a function call can be avoided.
Refactor do_get_kexec_buffer() to call of_ functions directly instead
of calling get_addr_size_cells() and remove get_addr_size_cells().
Co-developed-by: Prakhar Srivastava <prsriva@...ux.microsoft.com>
Signed-off-by: Prakhar Srivastava <prsriva@...ux.microsoft.com>
Signed-off-by: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
---
security/integrity/ima/ima_kexec.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index 25d79d521597..283631098b48 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -15,31 +15,21 @@
#include <linux/libfdt.h>
#include "ima.h"
-static int get_addr_size_cells(int *addr_cells, int *size_cells)
+static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
+ size_t *size)
{
+ int addr_cells, size_cells;
struct device_node *root;
root = of_find_node_by_path("/");
if (!root)
return -EINVAL;
- *addr_cells = of_n_addr_cells(root);
- *size_cells = of_n_size_cells(root);
+ addr_cells = of_n_addr_cells(root);
+ size_cells = of_n_size_cells(root);
of_node_put(root);
- return 0;
-}
-
-static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
- size_t *size)
-{
- int ret, addr_cells, size_cells;
-
- ret = get_addr_size_cells(&addr_cells, &size_cells);
- if (ret)
- return ret;
-
if (len < 4 * (addr_cells + size_cells))
return -ENOENT;
--
2.28.0
Powered by blists - more mailing lists