* [PATCH] video: fbdev: pvr2fb: remove unnecessary comparison of unsigned integer with < 0 @ 2019-07-22 20:33 ` Gustavo A. R. Silva 2019-08-19 14:01 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 2+ messages in thread From: Gustavo A. R. Silva @ 2019-07-22 20:33 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz Cc: dri-devel, linux-fbdev, linux-kernel, Gustavo A. R. Silva There is no need to compare *var->xoffset* or *var->yoffset* with < 0 because such variables are of type unsigned, making it impossible to hold a negative value. Fix this by removing such comparisons. Addresses-Coverity-ID: 1451964 ("Unsigned compared against 0") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> --- drivers/video/fbdev/pvr2fb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index 7ff4b6b84282..0a3b2b7c7891 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -458,13 +458,11 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) set_color_bitfields(var); if (var->vmode & FB_VMODE_YWRAP) { - if (var->xoffset || var->yoffset < 0 || - var->yoffset >= var->yres_virtual) { + if (var->xoffset || var->yoffset >= var->yres_virtual) { var->xoffset = var->yoffset = 0; } else { if (var->xoffset > var->xres_virtual - var->xres || - var->yoffset > var->yres_virtual - var->yres || - var->xoffset < 0 || var->yoffset < 0) + var->yoffset > var->yres_virtual - var->yres) var->xoffset = var->yoffset = 0; } } else { -- 2.22.0 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fbdev: pvr2fb: remove unnecessary comparison of unsigned integer with < 0 2019-07-22 20:33 ` [PATCH] video: fbdev: pvr2fb: remove unnecessary comparison of unsigned integer with < 0 Gustavo A. R. Silva @ 2019-08-19 14:01 ` Bartlomiej Zolnierkiewicz 0 siblings, 0 replies; 2+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2019-08-19 14:01 UTC (permalink / raw) To: Gustavo A. R. Silva; +Cc: linux-fbdev, linux-kernel, dri-devel On 7/22/19 10:33 PM, Gustavo A. R. Silva wrote: > There is no need to compare *var->xoffset* or *var->yoffset* with < 0 > because such variables are of type unsigned, making it impossible to > hold a negative value. > > Fix this by removing such comparisons. > > Addresses-Coverity-ID: 1451964 ("Unsigned compared against 0") > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Patch queued for v5.4, thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-19 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20190722203403epcas2p32d13bdd6f29bed37696385baca909abf@epcas2p3.samsung.com>
2019-07-22 20:33 ` [PATCH] video: fbdev: pvr2fb: remove unnecessary comparison of unsigned integer with < 0 Gustavo A. R. Silva
2019-08-19 14:01 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).