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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 26 Dec 2018 11:57:20 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Kangjie Lu <kjlu@....edu>
Cc:     pakki001@....edu, Kees Cook <keescook@...omium.org>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] keyboard: (samsung) fix a missing check of return value

Hi,

On Tue, Dec 25, 2018 at 07:51:29PM -0600, Kangjie Lu wrote:
> of_device_is_compatible() returns false if the device is incompatible.
> The fix adds a check for its return value;
> 
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/input/keyboard/samsung-keypad.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> index 1fe1aa2adf85..5ba940f3f76e 100644
> --- a/drivers/input/keyboard/samsung-keypad.c
> +++ b/drivers/input/keyboard/samsung-keypad.c
> @@ -387,9 +387,13 @@ static int samsung_keypad_probe(struct platform_device *pdev)
>  	keypad->stopped = true;
>  	init_waitqueue_head(&keypad->wait);
>  
> -	if (pdev->dev.of_node)
> -		keypad->type = of_device_is_compatible(pdev->dev.of_node,
> -					"samsung,s5pv210-keypad");
> +	if (pdev->dev.of_node) {
> +		error = of_device_is_compatible(pdev->dev.of_node,
> +				"samsung,s5pv210-keypad");
> +		if (!error)
> +			return -EINVAL;

What makes you think that not matching on this compatible is an error?
Have you looked at the rest of the dirver?

> +		keypad->type = error;
> +	}
>  	else
>  		keypad->type = platform_get_device_id(pdev)->driver_data;
>  
> -- 
> 2.17.2 (Apple Git-113)
> 

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ