All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Video: fbdev: Remove impossible condition.
@ 2016-11-11 12:24 Sachin Shukla
  2016-11-11 14:49 ` Timur Tabi
       [not found] ` <CGME20170208153734epcas5p1f56516b023b93b77f4bc43d1ac997769@epcas5p1.samsung.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Sachin Shukla @ 2016-11-11 12:24 UTC (permalink / raw)
  To: Timur Tabi, Tomi Valkeinen, linux-fsdevel, linux-kernel, sachiniiitm
  Cc: ravikant.s2, p.shailesh, ashish.kalra, vidushi.koul

From: "Sachin Shukla" <sachin.s5@samsung.com>

xoffset and yoffset of struct fb_var_screeninfo are unsigned and so
they can never be less than 0.

Signed-off-by: Sachin Shukla <sachin.s5@samsung.com>
---
 drivers/video/fbdev/amifb.c      |    8 +++-----
 drivers/video/fbdev/fsl-diu-fb.c |    9 +--------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
index 1d702e1..cc11c60 100644
--- a/drivers/video/fbdev/amifb.c
+++ b/drivers/video/fbdev/amifb.c
@@ -1484,13 +1484,11 @@ static int ami_decode_var(struct fb_var_screeninfo *var, struct amifb_par *par,
 		par->xoffset = var->xoffset;
 		par->yoffset = var->yoffset;
 		if (par->vmode & FB_VMODE_YWRAP) {
-			if (par->xoffset || par->yoffset < 0 ||
-			    par->yoffset >= par->vyres)
+			if (par->yoffset >= par->vyres)
 				par->xoffset = par->yoffset = 0;
 		} else {
-			if (par->xoffset < 0 ||
-			    par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) ||
-			    par->yoffset < 0 || par->yoffset > par->vyres - par->yres)
+			if (par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) ||
+			    par->yoffset > par->vyres - par->yres)
 				par->xoffset = par->yoffset = 0;
 		}
 	} else
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index fe00a07..c48a59e 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -703,12 +703,6 @@ static int fsl_diu_check_var(struct fb_var_screeninfo *var,
 	if (var->yres_virtual < var->yres)
 		var->yres_virtual = var->yres;
 
-	if (var->xoffset < 0)
-		var->xoffset = 0;
-
-	if (var->yoffset < 0)
-		var->yoffset = 0;
-
 	if (var->xoffset + info->var.xres > info->var.xres_virtual)
 		var->xoffset = info->var.xres_virtual - info->var.xres;
 
@@ -1254,8 +1248,7 @@ static int fsl_diu_pan_display(struct fb_var_screeninfo *var,
 	    (info->var.yoffset == var->yoffset))
 		return 0;	/* No change, do nothing */
 
-	if (var->xoffset < 0 || var->yoffset < 0
-	    || var->xoffset + info->var.xres > info->var.xres_virtual
+	if (var->xoffset + info->var.xres > info->var.xres_virtual
 	    || var->yoffset + info->var.yres > info->var.yres_virtual)
 		return -EINVAL;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Video: fbdev: Remove impossible condition.
  2016-11-11 12:24 [PATCH] Video: fbdev: Remove impossible condition Sachin Shukla
@ 2016-11-11 14:49 ` Timur Tabi
       [not found] ` <CGME20170208153734epcas5p1f56516b023b93b77f4bc43d1ac997769@epcas5p1.samsung.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2016-11-11 14:49 UTC (permalink / raw)
  To: Sachin Shukla, Tomi Valkeinen, linux-fsdevel, linux-kernel, sachiniiitm
  Cc: ravikant.s2, p.shailesh, ashish.kalra, vidushi.koul

Sachin Shukla wrote:
> From: "Sachin Shukla"<sachin.s5@samsung.com>
>
> xoffset and yoffset of struct fb_var_screeninfo are unsigned and so
> they can never be less than 0.
>
> Signed-off-by: Sachin Shukla<sachin.s5@samsung.com>

fsl-diu-fb portion:

Acked-by: Timur Tabi <timur@tabi.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Video: fbdev: Remove impossible condition.
       [not found] ` <CGME20170208153734epcas5p1f56516b023b93b77f4bc43d1ac997769@epcas5p1.samsung.com>
@ 2017-02-08 15:37   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-02-08 15:37 UTC (permalink / raw)
  To: Sachin Shukla
  Cc: Timur Tabi, Tomi Valkeinen, linux-fsdevel, linux-kernel,
	sachiniiitm, ravikant.s2, p.shailesh, ashish.kalra, vidushi.koul


Hi,

[ I'm the new Maintainer of fbdev. ]

On Friday, November 11, 2016 05:54:50 PM Sachin Shukla wrote:
> From: "Sachin Shukla" <sachin.s5@samsung.com>
> 
> xoffset and yoffset of struct fb_var_screeninfo are unsigned and so
> they can never be less than 0.
> 
> Signed-off-by: Sachin Shukla <sachin.s5@samsung.com>

Thanks, I split the patch on amifb and fsl-diu-fb parts and
queued them for 4.11 kernel (+ Timur's ACK has been added
to fsl-diu-fb patch).

> ---
>  drivers/video/fbdev/amifb.c      |    8 +++-----
>  drivers/video/fbdev/fsl-diu-fb.c |    9 +--------
>  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c
> index 1d702e1..cc11c60 100644
> --- a/drivers/video/fbdev/amifb.c
> +++ b/drivers/video/fbdev/amifb.c
> @@ -1484,13 +1484,11 @@ static int ami_decode_var(struct fb_var_screeninfo *var, struct amifb_par *par,
>  		par->xoffset = var->xoffset;
>  		par->yoffset = var->yoffset;
>  		if (par->vmode & FB_VMODE_YWRAP) {
> -			if (par->xoffset || par->yoffset < 0 ||
> -			    par->yoffset >= par->vyres)
> +			if (par->yoffset >= par->vyres)
>  				par->xoffset = par->yoffset = 0;
>  		} else {
> -			if (par->xoffset < 0 ||
> -			    par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) ||
> -			    par->yoffset < 0 || par->yoffset > par->vyres - par->yres)
> +			if (par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) ||
> +			    par->yoffset > par->vyres - par->yres)
>  				par->xoffset = par->yoffset = 0;
>  		}
>  	} else
> diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
> index fe00a07..c48a59e 100644
> --- a/drivers/video/fbdev/fsl-diu-fb.c
> +++ b/drivers/video/fbdev/fsl-diu-fb.c
> @@ -703,12 +703,6 @@ static int fsl_diu_check_var(struct fb_var_screeninfo *var,
>  	if (var->yres_virtual < var->yres)
>  		var->yres_virtual = var->yres;
>  
> -	if (var->xoffset < 0)
> -		var->xoffset = 0;
> -
> -	if (var->yoffset < 0)
> -		var->yoffset = 0;
> -
>  	if (var->xoffset + info->var.xres > info->var.xres_virtual)
>  		var->xoffset = info->var.xres_virtual - info->var.xres;
>  
> @@ -1254,8 +1248,7 @@ static int fsl_diu_pan_display(struct fb_var_screeninfo *var,
>  	    (info->var.yoffset == var->yoffset))
>  		return 0;	/* No change, do nothing */
>  
> -	if (var->xoffset < 0 || var->yoffset < 0
> -	    || var->xoffset + info->var.xres > info->var.xres_virtual
> +	if (var->xoffset + info->var.xres > info->var.xres_virtual
>  	    || var->yoffset + info->var.yres > info->var.yres_virtual)
>  		return -EINVAL;

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Video: fbdev: Remove impossible condition.
@ 2016-11-11 11:46 Shailendra Verma
  0 siblings, 0 replies; 4+ messages in thread
From: Shailendra Verma @ 2016-11-11 11:46 UTC (permalink / raw)
  To: Tomi Valkeinen, Michal Hocko, Dave Hansen, linux-kernel,
	Shailendra Verma, Shailendra Verma
  Cc: vidushi.koul

xoffset and yoffset of struct fb_var_screeninfo are unsigned and so
they can never be less than 0.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.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 a2564ab..23ada1f 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -460,13 +460,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->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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-08 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-11 12:24 [PATCH] Video: fbdev: Remove impossible condition Sachin Shukla
2016-11-11 14:49 ` Timur Tabi
     [not found] ` <CGME20170208153734epcas5p1f56516b023b93b77f4bc43d1ac997769@epcas5p1.samsung.com>
2017-02-08 15:37   ` Bartlomiej Zolnierkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2016-11-11 11:46 Shailendra Verma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.