staging: kpc2000: prevent underflow in cpld_reconfigure()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 24 Feb 2020 10:33:25 +0000 (13:33 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:02:16 +0000 (11:02 +0200)
commitfea3939c6ccc7e10e808e886b07b66a49a2e835e
tree11965dba855b66ddd7b97722647bc1da6d841cd8
parentb958dea86c26ba752cfc66ced635092e7bd21f35
staging: kpc2000: prevent underflow in cpld_reconfigure()

commit 72db61d7d17a475d3cc9de1a7c871d518fcd82f0 upstream.

This function should not allow negative values of "wr_val".  If
negatives are allowed then capping the upper bound at 7 is
meaningless.  Let's make it unsigned.

Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200224103325.hrxdnaeqsthplu42@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/kpc2000/kpc2000/core.c