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: <87zgkd8vnb.fsf@mpe.ellerman.id.au>
Date:   Fri, 22 Apr 2022 16:44:24 +1000
From:   Michael Ellerman <mpe@...erman.id.au>
To:     Yihao Han <hanyihao@...o.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Mark Brown <broonie@...nel.org>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        William Breathitt Gray <vilhelm.gray@...il.com>,
        Sven Van Asbroeck <TheSven73@...il.com>,
        Corentin Labbe <clabbe@...libre.com>,
        Yihao Han <hanyihao@...o.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>, linuxppc-dev@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org
Cc:     kernel@...o.com
Subject: Re: [PATCH] macintosh: macio_asic: fix resource_size.cocci warnings

Yihao Han <hanyihao@...o.com> writes:
> drivers/macintosh/macio_asic.c:219:26-29: WARNING:
> Suspicious code. resource_size is maybe missing with res
> drivers/macintosh/macio_asic.c:221:26-29: WARNING:
> Suspicious code. resource_size is maybe missing with res
>
> Use resource_size function on resource object instead of
> explicit computation.
>
> Generated by: scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Yihao Han <hanyihao@...o.com>
> ---
>  drivers/macintosh/macio_asic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
> index 1943a007e2d5..260fccb3863e 100644
> --- a/drivers/macintosh/macio_asic.c
> +++ b/drivers/macintosh/macio_asic.c
> @@ -216,9 +216,9 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res,
>  	/* Some older IDE resources have bogus sizes */
>  	if (of_node_name_eq(np, "IDE") || of_node_name_eq(np, "ATA") ||
>  	    of_node_is_type(np, "ide") || of_node_is_type(np, "ata")) {
> -		if (index == 0 && (res->end - res->start) > 0xfff)
> +		if (index == 0 && (resource_size(res)) > 0xfff)
>  			res->end = res->start + 0xfff;
> -		if (index == 1 && (res->end - res->start) > 0xff)
> +		if (index == 1 && (resource_size(res)) > 0xff)

Are you sure the conversion is correct? It's not exactly equivalent:

static inline resource_size_t resource_size(const struct resource *res)
{
	return res->end - res->start + 1;
}

cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ