Commit 60e5c189 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: atomisp: fix usage of access_ok() kAPI

This macro had its first parameter lost. Remove it.

While on it, fix the alignments where this macro is used.

Fixes: 96d4f267 ("Remove 'type' argument from access_ok() function")
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 99da4664
......@@ -29,7 +29,7 @@ static int get_atomisp_histogram32(struct atomisp_histogram *kp,
{
compat_uptr_t tmp;
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_histogram32)) ||
if (!access_ok(up, sizeof(struct atomisp_histogram32)) ||
get_user(kp->num_elements, &up->num_elements) ||
get_user(tmp, &up->data))
return -EFAULT;
......@@ -43,7 +43,7 @@ static int put_atomisp_histogram32(struct atomisp_histogram *kp,
{
compat_uptr_t tmp = (compat_uptr_t)((uintptr_t)kp->data);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct atomisp_histogram32)) ||
if (!access_ok(up, sizeof(struct atomisp_histogram32)) ||
put_user(kp->num_elements, &up->num_elements) ||
put_user(tmp, &up->data))
return -EFAULT;
......@@ -72,7 +72,7 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp,
{
compat_uptr_t tmp;
if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
if (!access_ok(up, sizeof(struct v4l2_framebuffer32)) ||
get_user(tmp, &up->base) ||
get_user(kp->capability, &up->capability) ||
get_user(kp->flags, &up->flags))
......@@ -95,25 +95,16 @@ static int get_atomisp_dis_statistics32(struct atomisp_dis_statistics *kp,
compat_uptr_t ver_prod_even_real;
compat_uptr_t ver_prod_even_imag;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_dis_statistics32)) ||
if (!access_ok(up, sizeof(struct atomisp_dis_statistics32)) ||
copy_from_user(kp, up, sizeof(struct atomisp_dvs_grid_info)) ||
get_user(hor_prod_odd_real,
&up->dvs2_stat.hor_prod.odd_real) ||
get_user(hor_prod_odd_imag,
&up->dvs2_stat.hor_prod.odd_imag) ||
get_user(hor_prod_even_real,
&up->dvs2_stat.hor_prod.even_real) ||
get_user(hor_prod_even_imag,
&up->dvs2_stat.hor_prod.even_imag) ||
get_user(ver_prod_odd_real,
&up->dvs2_stat.ver_prod.odd_real) ||
get_user(ver_prod_odd_imag,
&up->dvs2_stat.ver_prod.odd_imag) ||
get_user(ver_prod_even_real,
&up->dvs2_stat.ver_prod.even_real) ||
get_user(ver_prod_even_imag,
&up->dvs2_stat.ver_prod.even_imag) ||
get_user(hor_prod_odd_real, &up->dvs2_stat.hor_prod.odd_real) ||
get_user(hor_prod_odd_imag, &up->dvs2_stat.hor_prod.odd_imag) ||
get_user(hor_prod_even_real, &up->dvs2_stat.hor_prod.even_real) ||
get_user(hor_prod_even_imag, &up->dvs2_stat.hor_prod.even_imag) ||
get_user(ver_prod_odd_real, &up->dvs2_stat.ver_prod.odd_real) ||
get_user(ver_prod_odd_imag, &up->dvs2_stat.ver_prod.odd_imag) ||
get_user(ver_prod_even_real, up->dvs2_stat.ver_prod.even_real) ||
get_user(ver_prod_even_imag, &up->dvs2_stat.ver_prod.even_imag) ||
get_user(kp->exp_id, &up->exp_id))
return -EFAULT;
......@@ -148,25 +139,16 @@ static int put_atomisp_dis_statistics32(struct atomisp_dis_statistics *kp,
compat_uptr_t ver_prod_even_imag =
(compat_uptr_t)((uintptr_t)kp->dvs2_stat.ver_prod.even_imag);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_dis_statistics32)) ||
if (!access_ok(up, sizeof(struct atomisp_dis_statistics32)) ||
copy_to_user(up, kp, sizeof(struct atomisp_dvs_grid_info)) ||
put_user(hor_prod_odd_real,
&up->dvs2_stat.hor_prod.odd_real) ||
put_user(hor_prod_odd_imag,
&up->dvs2_stat.hor_prod.odd_imag) ||
put_user(hor_prod_even_real,
&up->dvs2_stat.hor_prod.even_real) ||
put_user(hor_prod_even_imag,
&up->dvs2_stat.hor_prod.even_imag) ||
put_user(ver_prod_odd_real,
&up->dvs2_stat.ver_prod.odd_real) ||
put_user(ver_prod_odd_imag,
&up->dvs2_stat.ver_prod.odd_imag) ||
put_user(ver_prod_even_real,
&up->dvs2_stat.ver_prod.even_real) ||
put_user(ver_prod_even_imag,
&up->dvs2_stat.ver_prod.even_imag) ||
put_user(hor_prod_odd_real, &up->dvs2_stat.hor_prod.odd_real) ||
put_user(hor_prod_odd_imag, &up->dvs2_stat.hor_prod.odd_imag) ||
put_user(hor_prod_even_real, &up->dvs2_stat.hor_prod.even_real) ||
put_user(hor_prod_even_imag, &up->dvs2_stat.hor_prod.even_imag) ||
put_user(ver_prod_odd_real, &up->dvs2_stat.ver_prod.odd_real) ||
put_user(ver_prod_odd_imag, &up->dvs2_stat.ver_prod.odd_imag) ||
put_user(ver_prod_even_real, &up->dvs2_stat.ver_prod.even_real) ||
put_user(ver_prod_even_imag, &up->dvs2_stat.ver_prod.even_imag) ||
put_user(kp->exp_id, &up->exp_id))
return -EFAULT;
......@@ -185,8 +167,7 @@ static int get_atomisp_dis_coefficients32(struct atomisp_dis_coefficients *kp,
compat_uptr_t ver_coefs_even_real;
compat_uptr_t ver_coefs_even_imag;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_dis_coefficients32)) ||
if (!access_ok(up, sizeof(struct atomisp_dis_coefficients32)) ||
copy_from_user(kp, up, sizeof(struct atomisp_dvs_grid_info)) ||
get_user(hor_coefs_odd_real, &up->hor_coefs.odd_real) ||
get_user(hor_coefs_odd_imag, &up->hor_coefs.odd_imag) ||
......@@ -216,8 +197,7 @@ static int get_atomisp_dvs_6axis_config32(struct atomisp_dvs_6axis_config *kp,
compat_uptr_t xcoords_uv;
compat_uptr_t ycoords_uv;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_dvs_6axis_config32)) ||
if (!access_ok(up, sizeof(struct atomisp_dvs_6axis_config32)) ||
get_user(kp->exp_id, &up->exp_id) ||
get_user(kp->width_y, &up->width_y) ||
get_user(kp->height_y, &up->height_y) ||
......@@ -242,8 +222,7 @@ static int get_atomisp_3a_statistics32(struct atomisp_3a_statistics *kp,
compat_uptr_t data;
compat_uptr_t rgby_data;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_3a_statistics32)) ||
if (!access_ok(up, sizeof(struct atomisp_3a_statistics32)) ||
copy_from_user(kp, up, sizeof(struct atomisp_grid_info)) ||
get_user(rgby_data, &up->rgby_data) ||
get_user(data, &up->data) ||
......@@ -263,8 +242,7 @@ static int put_atomisp_3a_statistics32(struct atomisp_3a_statistics *kp,
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
compat_uptr_t rgby_data = (compat_uptr_t)((uintptr_t)kp->rgby_data);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_3a_statistics32)) ||
if (!access_ok(up, sizeof(struct atomisp_3a_statistics32)) ||
copy_to_user(up, kp, sizeof(struct atomisp_grid_info)) ||
put_user(rgby_data, &up->rgby_data) ||
put_user(data, &up->data) ||
......@@ -282,8 +260,7 @@ static int get_atomisp_metadata_stat32(struct atomisp_metadata *kp,
compat_uptr_t data;
compat_uptr_t effective_width;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_metadata32)) ||
if (!access_ok(up, sizeof(struct atomisp_metadata32)) ||
get_user(data, &up->data) ||
get_user(kp->width, &up->width) ||
get_user(kp->height, &up->height) ||
......@@ -304,8 +281,7 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata *kp,
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
compat_uptr_t effective_width =
(compat_uptr_t)((uintptr_t)kp->effective_width);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_metadata32)) ||
if (!access_ok(up, sizeof(struct atomisp_metadata32)) ||
put_user(data, &up->data) ||
put_user(kp->width, &up->width) ||
put_user(kp->height, &up->height) ||
......@@ -324,8 +300,7 @@ static int put_atomisp_metadata_by_type_stat32(
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
compat_uptr_t effective_width =
(compat_uptr_t)((uintptr_t)kp->effective_width);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_metadata_with_type32)) ||
if (!access_ok(up, sizeof(struct atomisp_metadata_with_type32)) ||
put_user(data, &up->data) ||
put_user(kp->width, &up->width) ||
put_user(kp->height, &up->height) ||
......@@ -345,8 +320,7 @@ static int get_atomisp_metadata_by_type_stat32(
compat_uptr_t data;
compat_uptr_t effective_width;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_metadata_with_type32)) ||
if (!access_ok(up, sizeof(struct atomisp_metadata_with_type32)) ||
get_user(data, &up->data) ||
get_user(kp->width, &up->width) ||
get_user(kp->height, &up->height) ||
......@@ -366,8 +340,7 @@ static int get_atomisp_morph_table32(struct atomisp_morph_table *kp,
{
unsigned int n = ATOMISP_MORPH_TABLE_NUM_PLANES;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_morph_table32)) ||
if (!access_ok(up, sizeof(struct atomisp_morph_table32)) ||
get_user(kp->enabled, &up->enabled) ||
get_user(kp->width, &up->width) ||
get_user(kp->height, &up->height))
......@@ -391,8 +364,7 @@ static int put_atomisp_morph_table32(struct atomisp_morph_table *kp,
{
unsigned int n = ATOMISP_MORPH_TABLE_NUM_PLANES;
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_morph_table32)) ||
if (!access_ok(up, sizeof(struct atomisp_morph_table32)) ||
put_user(kp->enabled, &up->enabled) ||
put_user(kp->width, &up->width) ||
put_user(kp->height, &up->height))
......@@ -415,7 +387,7 @@ static int get_atomisp_overlay32(struct atomisp_overlay *kp,
struct atomisp_overlay32 __user *up)
{
compat_uptr_t frame;
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_overlay32)) ||
if (!access_ok(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) ||
......@@ -423,14 +395,10 @@ static int get_atomisp_overlay32(struct atomisp_overlay *kp,
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->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))
return -EFAULT;
......@@ -443,7 +411,7 @@ static int put_atomisp_overlay32(struct atomisp_overlay *kp,
{
compat_uptr_t frame = (compat_uptr_t)((uintptr_t)kp->frame);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct atomisp_overlay32)) ||
if (!access_ok(up, sizeof(struct atomisp_overlay32)) ||
put_user(frame, &up->frame) ||
put_user(kp->bg_y, &up->bg_y) ||
put_user(kp->bg_u, &up->bg_u) ||
......@@ -451,14 +419,10 @@ static int put_atomisp_overlay32(struct atomisp_overlay *kp,
put_user(kp->blend_input_perc_y, &up->blend_input_perc_y) ||
put_user(kp->blend_input_perc_u, &up->blend_input_perc_u) ||
put_user(kp->blend_input_perc_v, &up->blend_input_perc_v) ||
put_user(kp->blend_overlay_perc_y,
&up->blend_overlay_perc_y) ||
put_user(kp->blend_overlay_perc_u,
&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->blend_overlay_perc_y, &up->blend_overlay_perc_y) ||
put_user(kp->blend_overlay_perc_u, &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;
......@@ -471,8 +435,7 @@ static int get_atomisp_calibration_group32(
{
compat_uptr_t calb_grp_values;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_calibration_group32)) ||
if (!access_ok(up, sizeof(struct atomisp_calibration_group32)) ||
get_user(kp->size, &up->size) ||
get_user(kp->type, &up->type) ||
get_user(calb_grp_values, &up->calb_grp_values))
......@@ -489,8 +452,7 @@ static int put_atomisp_calibration_group32(
compat_uptr_t calb_grp_values =
(compat_uptr_t)((uintptr_t)kp->calb_grp_values);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_calibration_group32)) ||
if (!access_ok(up, sizeof(struct atomisp_calibration_group32)) ||
put_user(kp->size, &up->size) ||
put_user(kp->type, &up->type) ||
put_user(calb_grp_values, &up->calb_grp_values))
......@@ -504,8 +466,7 @@ static int get_atomisp_acc_fw_load32(struct atomisp_acc_fw_load *kp,
{
compat_uptr_t data;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_acc_fw_load32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_load32)) ||
get_user(kp->size, &up->size) ||
get_user(kp->fw_handle, &up->fw_handle) ||
get_user(data, &up->data))
......@@ -520,8 +481,7 @@ static int put_atomisp_acc_fw_load32(struct atomisp_acc_fw_load *kp,
{
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_acc_fw_load32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_load32)) ||
put_user(kp->size, &up->size) ||
put_user(kp->fw_handle, &up->fw_handle) ||
put_user(data, &up->data))
......@@ -535,7 +495,7 @@ static int get_atomisp_acc_fw_arg32(struct atomisp_acc_fw_arg *kp,
{
compat_uptr_t value;
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_acc_fw_arg32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_arg32)) ||
get_user(kp->fw_handle, &up->fw_handle) ||
get_user(kp->index, &up->index) ||
get_user(value, &up->value) ||
......@@ -551,7 +511,7 @@ static int put_atomisp_acc_fw_arg32(struct atomisp_acc_fw_arg *kp,
{
compat_uptr_t value = (compat_uptr_t)((uintptr_t)kp->value);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct atomisp_acc_fw_arg32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_arg32)) ||
put_user(kp->fw_handle, &up->fw_handle) ||
put_user(kp->index, &up->index) ||
put_user(value, &up->value) ||
......@@ -566,8 +526,7 @@ static int get_v4l2_private_int_data32(struct v4l2_private_int_data *kp,
{
compat_uptr_t data;
if (!access_ok(VERIFY_READ, up,
sizeof(struct v4l2_private_int_data32)) ||
if (!access_ok(up, sizeof(struct v4l2_private_int_data32)) ||
get_user(kp->size, &up->size) ||
get_user(data, &up->data) ||
get_user(kp->reserved[0], &up->reserved[0]) ||
......@@ -583,8 +542,7 @@ static int put_v4l2_private_int_data32(struct v4l2_private_int_data *kp,
{
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct v4l2_private_int_data32)) ||
if (!access_ok(up, sizeof(struct v4l2_private_int_data32)) ||
put_user(kp->size, &up->size) ||
put_user(data, &up->data) ||
put_user(kp->reserved[0], &up->reserved[0]) ||
......@@ -599,8 +557,7 @@ static int get_atomisp_shading_table32(struct atomisp_shading_table *kp,
{
unsigned int n = ATOMISP_NUM_SC_COLORS;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_shading_table32)) ||
if (!access_ok(up, sizeof(struct atomisp_shading_table32)) ||
get_user(kp->enable, &up->enable) ||
get_user(kp->sensor_width, &up->sensor_width) ||
get_user(kp->sensor_height, &up->sensor_height) ||
......@@ -623,7 +580,7 @@ static int get_atomisp_acc_map32(struct atomisp_acc_map *kp,
{
compat_uptr_t user_ptr;
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_acc_map32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_map32)) ||
get_user(kp->flags, &up->flags) ||
get_user(kp->length, &up->length) ||
get_user(user_ptr, &up->user_ptr) ||
......@@ -643,7 +600,7 @@ static int put_atomisp_acc_map32(struct atomisp_acc_map *kp,
{
compat_uptr_t user_ptr = (compat_uptr_t)((uintptr_t)kp->user_ptr);
if (!access_ok(VERIFY_WRITE, up, sizeof(struct atomisp_acc_map32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_map32)) ||
put_user(kp->flags, &up->flags) ||
put_user(kp->length, &up->length) ||
put_user(user_ptr, &up->user_ptr) ||
......@@ -660,8 +617,7 @@ static int put_atomisp_acc_map32(struct atomisp_acc_map *kp,
static int get_atomisp_acc_s_mapped_arg32(struct atomisp_acc_s_mapped_arg *kp,
struct atomisp_acc_s_mapped_arg32 __user *up)
{
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_acc_s_mapped_arg32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_s_mapped_arg32)) ||
get_user(kp->fw_handle, &up->fw_handle) ||
get_user(kp->memory, &up->memory) ||
get_user(kp->length, &up->length) ||
......@@ -674,8 +630,7 @@ static int get_atomisp_acc_s_mapped_arg32(struct atomisp_acc_s_mapped_arg *kp,
static int put_atomisp_acc_s_mapped_arg32(struct atomisp_acc_s_mapped_arg *kp,
struct atomisp_acc_s_mapped_arg32 __user *up)
{
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_acc_s_mapped_arg32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_s_mapped_arg32)) ||
put_user(kp->fw_handle, &up->fw_handle) ||
put_user(kp->memory, &up->memory) ||
put_user(kp->length, &up->length) ||
......@@ -694,7 +649,7 @@ static int get_atomisp_parameters32(struct atomisp_parameters *kp,
void __user *user_ptr;
unsigned int stp, mtp, dcp, dscp = 0;
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_parameters32)))
if (!access_ok(up, sizeof(struct atomisp_parameters32)))
return -EFAULT;
while (n >= 0) {
......@@ -806,8 +761,7 @@ static int get_atomisp_acc_fw_load_to_pipe32(
struct atomisp_acc_fw_load_to_pipe32 __user *up)
{
compat_uptr_t data;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_acc_fw_load_to_pipe32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_load_to_pipe32)) ||
get_user(kp->flags, &up->flags) ||
get_user(kp->fw_handle, &up->fw_handle) ||
get_user(kp->size, &up->size) ||
......@@ -827,8 +781,7 @@ static int put_atomisp_acc_fw_load_to_pipe32(
struct atomisp_acc_fw_load_to_pipe32 __user *up)
{
compat_uptr_t data = (compat_uptr_t)((uintptr_t)kp->data);
if (!access_ok(VERIFY_WRITE, up,
sizeof(struct atomisp_acc_fw_load_to_pipe32)) ||
if (!access_ok(up, sizeof(struct atomisp_acc_fw_load_to_pipe32)) ||
put_user(kp->flags, &up->flags) ||
put_user(kp->fw_handle, &up->fw_handle) ||
put_user(kp->size, &up->size) ||
......@@ -847,8 +800,7 @@ static int get_atomisp_sensor_ae_bracketing_lut(
struct atomisp_sensor_ae_bracketing_lut32 __user *up)
{
compat_uptr_t lut;
if (!access_ok(VERIFY_READ, up,
sizeof(struct atomisp_sensor_ae_bracketing_lut32)) ||
if (!access_ok(up, sizeof(struct atomisp_sensor_ae_bracketing_lut32)) ||
get_user(kp->lut_size, &up->lut_size) ||
get_user(lut, &up->lut))
return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment