diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-04-14 15:25:40 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-28 14:28:17 +0200 |
commit | 6eeabd8b2b8a2a495cbdec754b9ddc9c4f811fa8 (patch) | |
tree | 44038bc750fbf340eef5253063e0d2933d5e11ae | |
parent | 8ed78a154ec463a0f72f2421b93750aef9692cab (diff) |
staging: media: atomisp: fix range checking on clk_num
The range checking on clk_num is incorrect; fix these so that invalid
clk_num values are detected correctly.
Detected by static analysis with by PVS-Studio
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c b/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c index a322539d2621..f96789a31819 100644 --- a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c +++ b/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c @@ -67,7 +67,7 @@ int vlv2_plat_set_clock_freq(int clk_num, int freq_type) { void __iomem *addr; - if (clk_num < 0 && clk_num > MAX_CLK_COUNT) { + if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { pr_err("Clock number out of range (%d)\n", clk_num); return -EINVAL; } @@ -103,7 +103,7 @@ int vlv2_plat_get_clock_freq(int clk_num) { u32 ret; - if (clk_num < 0 && clk_num > MAX_CLK_COUNT) { + if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { pr_err("Clock number out of range (%d)\n", clk_num); return -EINVAL; } @@ -133,7 +133,7 @@ int vlv2_plat_configure_clock(int clk_num, u32 conf) { void __iomem *addr; - if (clk_num < 0 && clk_num > MAX_CLK_COUNT) { + if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { pr_err("Clock number out of range (%d)\n", clk_num); return -EINVAL; } @@ -169,7 +169,7 @@ int vlv2_plat_get_clock_status(int clk_num) { int ret; - if (clk_num < 0 && clk_num > MAX_CLK_COUNT) { + if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { pr_err("Clock number out of range (%d)\n", clk_num); return -EINVAL; } |