Skip to contentSkip to conversation

Staging: media: atomisp: Remove duplicated argument to ||

PATCH New Georgiana Chelu 1 participant 1 message Oct 17, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: media: atomisp: Remove duplicated argument to ||

get_user() copies a variable from user space to kernel space put_user() copies a variable from kenel space to user space.

Remove duplicated argument to || because consecutive calls of get_user and put_user over the same arguments will have the same result. The output of the code is the same. This patch just removes the duplicates.

Issue found by scripts/coccinelle/tests/doubletest.cocci script.

---

Changes in v2:
* changed the commit message to explain why the patch is needed

Here is the whole statement to better see the duplicates. The same is for the put_user function.

if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_overlay32)) || get_user(frame, &up->frame) ||

get_user(kp->bg_y, &up->bg_y) ||
get_user(kp->bg_u, &up->bg_u) ||
get_user(kp->bg_v, &up->bg_v) ||
get_user(kp->blend_input_perc_y, &up->blend_input_perc_y) ||
get_user(kp->blend_input_perc_u, &up->blend_input_perc_u) ||
get_user(kp->blend_input_perc_v, &up->blend_input_perc_v) ||
get_user(kp->blend_overlay_perc_y, &up->blend_overlay_perc_y) ||
get_user(kp->blend_overlay_perc_u, &up->blend_overlay_perc_u) ||
get_user(kp->blend_overlay_perc_v, &up->blend_overlay_perc_v) ||
get_user(kp->blend_overlay_perc_u, &up->blend_overlay_perc_u) ||

get_user(kp->overlay_start_x, &up->overlay_start_y)) {...}

 drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c +0 -4
index 0592ac1f2832..a27ecbe89b57 100644
@@ -432,8 +432,6 @@ static int get_atomisp_overlay32(struct atomisp_overlay *kp,
 				&up->blend_overlay_perc_u) ||
 		get_user(kp->blend_overlay_perc_v,
 				&up->blend_overlay_perc_v) ||
-		get_user(kp->blend_overlay_perc_u,
-				&up->blend_overlay_perc_u) ||
 		get_user(kp->overlay_start_x, &up->overlay_start_y))
 			return -EFAULT;
 
@@ -460,8 +458,6 @@ static int put_atomisp_overlay32(struct atomisp_overlay *kp,
 				&up->blend_overlay_perc_u) ||
 		put_user(kp->blend_overlay_perc_v,
 				&up->blend_overlay_perc_v) ||
-		put_user(kp->blend_overlay_perc_u,
-				&up->blend_overlay_perc_u) ||
 		put_user(kp->overlay_start_x, &up->overlay_start_y))
 			return -EFAULT;
 
Signature · 1 line
2.11.0