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]
Date:	Sat, 28 Feb 2015 11:15:19 +0100
From:	Hans de Goede <hdegoede@...hat.com>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	linux-input@...r.kernel.org
CC:	Benjamin Tissoires <benjamin.tissoires@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Input: psmouse - when comparing PNP IDs ignore case

Hi,

On 28-02-15 01:18, Dmitry Torokhov wrote:
> PNP IDs are supposed to be case-insensitive and so we should compare
> them as such.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>

Looks good:

Acked-by: Hans de Goede <hdegoede@...hat.com>

Regards,

Hans

> ---
>   drivers/input/mouse/psmouse-base.c | 39 +++++++++++++++++++++++++++++++-------
>   1 file changed, 32 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
> index 4ccd01d..a175496 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -463,19 +463,44 @@ static int psmouse_poll(struct psmouse *psmouse)
>   			   PSMOUSE_CMD_POLL | (psmouse->pktsize << 8));
>   }
>
> +static bool psmouse_check_pnp_id(const char *id, const char * const ids[])
> +{
> +	int i;
> +
> +	for (i = 0; ids[i]; i++)
> +		if (!strcasecmp(id, ids[i]))
> +			return true;
> +
> +	return false;
> +}
> +
>   /*
>    * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids.
>    */
>   bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
>   {
> -	int i;
> -
> -	if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
> -		for (i = 0; ids[i]; i++)
> -			if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
> -				return true;
> +	struct serio *serio = psmouse->ps2dev.serio;
> +	char *p, *fw_id_copy, *save_ptr;
> +	bool found = false;
> +
> +	if (!strncmp(serio->firmware_id, "PNP:", 4))
> +		return false;
> +
> +	fw_id_copy = kstrndup(&serio->firmware_id[4],
> +			      sizeof(serio->firmware_id) - 4,
> +			      GFP_KERNEL);
> +	if (!fw_id_copy)
> +		return false;
> +
> +	save_ptr = fw_id_copy;
> +	while ((p = strsep(&fw_id_copy, " ")) != NULL) {
> +		if (psmouse_check_pnp_id(p, ids))
> +			found = true;
> +			break;
> +	}
>
> -	return false;
> +	kfree(save_ptr);
> +	return found;
>   }
>
>   /*
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ