staging: fsl-mc/dpio: Fix incorrect comparison
authorIoana Radulescu <ruxandra.radulescu@nxp.com>
Thu, 28 Sep 2017 14:10:33 +0000 (09:10 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Dec 2017 12:40:42 +0000 (13:40 +0100)
commit9093d8bc530402a7d7651be40dd53b0b97a813af
tree45caab80cc4bfbb1715b9865459265714232b8ae
parentc25bec2de9268122407a3f431dd7d031c06f293d
staging: fsl-mc/dpio: Fix incorrect comparison

[ Upstream commit 8dabf52ffb6445fa5bcc8b6d2ecb615f60d0dd12 ]

For some dpio functions, a cpu id parameter value of -1 is
valid and means "any". But when trying to validate this param
value against an upper limit, in this case num_possible_cpus(),
we risk obtaining the wrong result due to an implicit cast.

Avoid an incorrect check result by explicitly comparing the
cpu id with the "any" value before verifying the upper bound.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-mc/bus/dpio/dpio-service.c
drivers/staging/fsl-mc/include/dpaa2-io.h