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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8Y1dRSOdYesQ5cG1JTDc2W-mdz-OvcJBBTYz3X-EiUQPS8=g@mail.gmail.com>
Date: Wed, 3 Jan 2024 10:17:45 -0800
From: Ray Jui <ray.jui@...adcom.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, 
	Russell King <linux@...linux.org.uk>, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Ray Jui <rjui@...adcom.com>, Scott Branden <sbranden@...adcom.com>, 
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>, netdev@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K

On Fri, Dec 29, 2023 at 6:53 AM Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
wrote:

> Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
> with alignment. Replace also literals with SZ_4K.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
>  drivers/net/mdio/mdio-mux-bcm-iproc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c
> b/drivers/net/mdio/mdio-mux-bcm-iproc.c
> index a750bd4c77a0..1ce7d67ba72e 100644
> --- a/drivers/net/mdio/mdio-mux-bcm-iproc.c
> +++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright 2016 Broadcom
>   */
> +#include <linux/align.h>
>  #include <linux/clk.h>
>  #include <linux/delay.h>
>  #include <linux/device.h>
> @@ -11,6 +12,7 @@
>  #include <linux/of_mdio.h>
>  #include <linux/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/sizes.h>
>
>  #define MDIO_RATE_ADJ_EXT_OFFSET       0x000
>  #define MDIO_RATE_ADJ_INT_OFFSET       0x004
> @@ -220,12 +222,12 @@ static int mdio_mux_iproc_probe(struct
> platform_device *pdev)
>         md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>         if (IS_ERR(md->base))
>                 return PTR_ERR(md->base);
> -       if (res->start & 0xfff) {
> +       if (!IS_ALIGNED(res->start, SZ_4K)) {
>                 /* For backward compatibility in case the
>                  * base address is specified with an offset.
>                  */
>                 dev_info(&pdev->dev, "fix base address in dt-blob\n");
> -               res->start &= ~0xfff;
> +               res->start = ALIGN_DOWN(res->start, SZ_4K);
>                 res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
>         }
>
> --
> 2.39.2
>

Acked-by: Ray Jui <ray.jui@...adcom.com>

Thanks.

Content of type "text/html" skipped

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4194 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ