]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
staging: dwc2: fix off-by-one in check for max_packet_count parameter
authorMatthijs Kooijman <matthijs@stdin.nl>
Fri, 30 Aug 2013 16:45:12 +0000 (18:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Aug 2013 21:14:51 +0000 (14:14 -0700)
commit3b9edf88472e9259f9361aa485a1f399e54c4c77
tree6135c53b044f77e975ad1e8773c15aebdfa3cc89
parent4ab799df6d71694ce091780af31484d6a63c2939
staging: dwc2: fix off-by-one in check for max_packet_count parameter

Previously, the max_packet_count could be set to 1 << x, where x is the
number of bits available (width + 4 in the code). Since 1 << x requires
x + 1 bits to represent, this will not work. The real maximum value is
(1 << x) - 1. This value is already used the default when the set value
is invalid, but the upper limit for the set value was off-by-one.

This change makes the check the same as the one for max_transfer_size,
which was already correct.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dwc2/core.c