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]
Date:   Wed, 10 Apr 2019 17:10:11 +0100
From:   Sudeep Holla <sudeep.holla@....com>
To:     Aditya Pakki <pakki001@....edu>
Cc:     kjlu@....edu, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Sudeep Holla <sudeep.holla@....com>
Subject: Re: [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device

On Fri, Mar 22, 2019 at 04:55:03PM -0500, Aditya Pakki wrote:
> of_match_device can return NULL if no matching device is found.
> This patch replaces the function with of_device_get_match_data.
> and returns -EINVAL in such a scenario.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
>
> ---
> v1: Replace of_match_device with of_device_get_match_data
> ---
>  drivers/firmware/arm_scmi/driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 8f952f2f1a29..a44852a1d5bc 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -798,7 +798,9 @@ static int scmi_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>
> -	desc = of_match_device(scmi_of_match, dev)->data;

probe won't be called be there's no match. And we mandate data in the
driver, so this should never happen.

> +	desc = of_device_get_match_data(dev);

Having said that, I am happy to use the above function.

> +	if (!desc)
> +		return -EINVAL;
>

NULL check seems totally unnecessary, but it's in probe so I am fine.
Applied with updates to subject and commit message.

--
Regards,
Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ