]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: core: Copy parameter string correctly and remove superfluous null check
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Tue, 10 Apr 2018 09:49:30 +0000 (17:49 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 10 Apr 2018 14:45:28 +0000 (09:45 -0500)
commitee66d8294fc481549f52d701d8ef45a265432455
tree069e223e530ba9d7a8ffe0a19f5a79d730cf4212
parent389cb8cf92803b89161444ddf9d8d64c0d19b948
usb: core: Copy parameter string correctly and remove superfluous null check

BugLink: https://bugs.launchpad.net/bugs/1762695
strsep() slices string, so the string gets copied by
param_set_copystring() at the end of quirks_param_set() is not the
original value.
Fix that by calling param_set_copystring() earlier.

The null check for val is unnecessary, the caller of quirks_param_set()
does not pass null string.
Remove the superfluous null check. This is found by Smatch.

Fixes: 027bd6cafd9a ("usb: core: Add "quirks" parameter for usbcore")
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a030501499b032bd218e1d01c07677bab6a0d53f)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/usb/core/quirks.c