lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221223024407.2107699-1-tanmay.shah@amd.com>
Date:   Thu, 22 Dec 2022 18:44:07 -0800
From:   Tanmay Shah <tanmay.shah@....com>
To:     <christophe.jaillet@...adoo.fr>
CC:     <jassisinghbrar@...il.com>, <kernel-janitors@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <michal.simek@....com>,
        <tanmay.shah@....com>
Subject: RE: [PATCH] mailbox: zynq: Switch to flexible array to simplify code

Reviewed-by: Tanmay Shah <tanmay.shah@....com>

Thanks for your patch. The patch looks good to me.

(Update: Fixed subject of email)

>From 48e51754dd7cd49abdf3adc7a01e6863bf5e3764 Mon Sep 17 00:00:00 2001
>From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>Date: Sun, 20 Nov 2022 09:25:54 +0100
>Subject: [PATCH] mailbox: zynq: Switch to flexible array to simplify code
>
>Using flexible array is more straight forward. It
>  - saves 1 pointer in the 'zynqmp_ipi_pdata' structure
>  - saves an indirection when using this array
>  - saves some LoC and avoids some always spurious pointer arithmetic
>
>Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>---
> drivers/mailbox/zynqmp-ipi-mailbox.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
>index 12e004ff1a14..a4c8d23c76e2 100644
>--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
>+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
>@@ -110,7 +110,7 @@ struct zynqmp_ipi_pdata {
> 	unsigned int method;
> 	u32 local_id;
> 	int num_mboxes;
>-	struct zynqmp_ipi_mbox *ipi_mboxes;
>+	struct zynqmp_ipi_mbox ipi_mboxes[];
> };
> 
> static struct device_driver zynqmp_ipi_mbox_driver = {
>@@ -635,7 +635,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
> 	int num_mboxes, ret = -EINVAL;
> 
> 	num_mboxes = of_get_child_count(np);
>-	pdata = devm_kzalloc(dev, sizeof(*pdata) + (num_mboxes * sizeof(*mbox)),
>+	pdata = devm_kzalloc(dev, struct_size(pdata, ipi_mboxes, num_mboxes),
> 			     GFP_KERNEL);
> 	if (!pdata)
> 		return -ENOMEM;
>@@ -649,8 +649,6 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
> 	}
> 
> 	pdata->num_mboxes = num_mboxes;
>-	pdata->ipi_mboxes = (struct zynqmp_ipi_mbox *)
>-			    ((char *)pdata + sizeof(*pdata));
> 
> 	mbox = pdata->ipi_mboxes;
> 	for_each_available_child_of_node(np, nc) {
>
>-- 
>2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ