From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> To: unlisted-recipients:; (no To-header on input) Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, Sakari Ailus <sakari.ailus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de> Subject: [PATCH v2 40/41] media: atomisp: get rid of set_fs() dirty hacks Date: Sat, 30 May 2020 08:55:57 +0200 Message-ID: <20234729bd1227640b0ba1976fec9e1121d3437c.1590821410.git.mchehab+huawei@kernel.org> (raw) In-Reply-To: <cover.1590821410.git.mchehab+huawei@kernel.org> This file was based on an older version of the V4L2 compat32 code, which had this ugly hack. Change the code to remove the hack. Yet, the entire compat32 code is currently commented out. So, let's add a FIXME note at the code, as we may need to check if some of the atomisp specific ioctls would require it. It is not worth to do such checks now, as we may get rid of several of them while cleaning up other things while at staging. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- drivers/staging/media/atomisp/TODO | 3 + .../atomisp/pci/atomisp_compat_ioctl32.c | 89 ++++++++++--------- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/drivers/staging/media/atomisp/TODO b/drivers/staging/media/atomisp/TODO index e58643a9de43..9e46015ebcd5 100644 --- a/drivers/staging/media/atomisp/TODO +++ b/drivers/staging/media/atomisp/TODO @@ -161,6 +161,9 @@ TODO for this driver until the other work is done, as there will be a lot of code churn until this driver becomes functional again. +16. Fix the compat32 code and remove the comment preventing it to be + called. + Limitations =========== diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c index 3079043f1fac..e2e3a242b95d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c @@ -847,9 +847,17 @@ static long atomisp_do_compat_ioctl(struct file *file, struct atomisp_metadata_with_type md_with_type; struct atomisp_sensor_ae_bracketing_lut lut; } karg; - mm_segment_t old_fs; - void __user *up = compat_ptr(arg); + void __user *p32 = compat_ptr(arg); + void __user *new_p64 = NULL; long err = -ENOIOCTLCMD; + int compatible_arg = 1; + + /* + * FIXME: should verify if any of the functions below will be + * setting a pointer. If so, compatible_arg should be zeroed. + * + * Please see v4l2-compat-ioctl32.c for more details + */ /* First, convert the command. */ switch (cmd) { @@ -936,130 +944,131 @@ static long atomisp_do_compat_ioctl(struct file *file, switch (cmd) { case ATOMISP_IOC_G_HISTOGRAM: case ATOMISP_IOC_S_HISTOGRAM: - err = get_atomisp_histogram32(&karg.his, up); + err = get_atomisp_histogram32(&karg.his, p32); break; case ATOMISP_IOC_G_DIS_STAT: - err = get_atomisp_dis_statistics32(&karg.dis_s, up); + err = get_atomisp_dis_statistics32(&karg.dis_s, p32); break; case ATOMISP_IOC_S_DIS_COEFS: - err = get_atomisp_dis_coefficients32(&karg.dis_c, up); + err = get_atomisp_dis_coefficients32(&karg.dis_c, p32); break; case ATOMISP_IOC_S_DIS_VECTOR: - err = get_atomisp_dvs_6axis_config32(&karg.dvs_c, up); + err = get_atomisp_dvs_6axis_config32(&karg.dvs_c, p32); break; case ATOMISP_IOC_G_3A_STAT: - err = get_atomisp_3a_statistics32(&karg.s3a_s, up); + err = get_atomisp_3a_statistics32(&karg.s3a_s, p32); break; case ATOMISP_IOC_G_ISP_GDC_TAB: case ATOMISP_IOC_S_ISP_GDC_TAB: - err = get_atomisp_morph_table32(&karg.mor_t, up); + err = get_atomisp_morph_table32(&karg.mor_t, p32); break; case ATOMISP_IOC_S_ISP_FPN_TABLE: - err = get_v4l2_framebuffer32(&karg.v4l2_buf, up); + err = get_v4l2_framebuffer32(&karg.v4l2_buf, p32); break; case ATOMISP_IOC_G_ISP_OVERLAY: case ATOMISP_IOC_S_ISP_OVERLAY: - err = get_atomisp_overlay32(&karg.overlay, up); + err = get_atomisp_overlay32(&karg.overlay, p32); break; case ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP: - err = get_atomisp_calibration_group32(&karg.cal_grp, up); + err = get_atomisp_calibration_group32(&karg.cal_grp, p32); break; case ATOMISP_IOC_ACC_LOAD: - err = get_atomisp_acc_fw_load32(&karg.acc_fw_load, up); + err = get_atomisp_acc_fw_load32(&karg.acc_fw_load, p32); break; case ATOMISP_IOC_ACC_S_ARG: case ATOMISP_IOC_ACC_DESTAB: - err = get_atomisp_acc_fw_arg32(&karg.acc_fw_arg, up); + err = get_atomisp_acc_fw_arg32(&karg.acc_fw_arg, p32); break; case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: case ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA: - err = get_v4l2_private_int_data32(&karg.v4l2_pri_data, up); + err = get_v4l2_private_int_data32(&karg.v4l2_pri_data, p32); break; case ATOMISP_IOC_S_ISP_SHD_TAB: - err = get_atomisp_shading_table32(&karg.shd_tbl, up); + err = get_atomisp_shading_table32(&karg.shd_tbl, p32); break; case ATOMISP_IOC_ACC_MAP: case ATOMISP_IOC_ACC_UNMAP: - err = get_atomisp_acc_map32(&karg.acc_map, up); + err = get_atomisp_acc_map32(&karg.acc_map, p32); break; case ATOMISP_IOC_ACC_S_MAPPED_ARG: - err = get_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, up); + err = get_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, p32); break; case ATOMISP_IOC_S_PARAMETERS: - err = get_atomisp_parameters32(&karg.param, up); + err = get_atomisp_parameters32(&karg.param, p32); break; case ATOMISP_IOC_ACC_LOAD_TO_PIPE: err = get_atomisp_acc_fw_load_to_pipe32(&karg.acc_fw_to_pipe, - up); + p32); break; case ATOMISP_IOC_G_METADATA: - err = get_atomisp_metadata_stat32(&karg.md, up); + err = get_atomisp_metadata_stat32(&karg.md, p32); break; case ATOMISP_IOC_G_METADATA_BY_TYPE: err = get_atomisp_metadata_by_type_stat32(&karg.md_with_type, - up); + p32); break; case ATOMISP_IOC_S_SENSOR_AE_BRACKETING_LUT: - err = get_atomisp_sensor_ae_bracketing_lut(&karg.lut, up); + err = get_atomisp_sensor_ae_bracketing_lut(&karg.lut, p32); break; } if (err) return err; - old_fs = get_fs(); - set_fs(KERNEL_DS); - err = native_ioctl(file, cmd, (unsigned long)&karg); - set_fs(old_fs); + if (compatible_arg) + err = native_ioctl(file, cmd, (unsigned long)p32); + else + err = native_ioctl(file, cmd, (unsigned long)new_p64); + if (err) return err; switch (cmd) { case ATOMISP_IOC_G_HISTOGRAM: - err = put_atomisp_histogram32(&karg.his, up); + err = put_atomisp_histogram32(&karg.his, p32); break; case ATOMISP_IOC_G_DIS_STAT: - err = put_atomisp_dis_statistics32(&karg.dis_s, up); + err = put_atomisp_dis_statistics32(&karg.dis_s, p32); break; case ATOMISP_IOC_G_3A_STAT: - err = put_atomisp_3a_statistics32(&karg.s3a_s, up); + err = put_atomisp_3a_statistics32(&karg.s3a_s, p32); break; case ATOMISP_IOC_G_ISP_GDC_TAB: - err = put_atomisp_morph_table32(&karg.mor_t, up); + err = put_atomisp_morph_table32(&karg.mor_t, p32); break; case ATOMISP_IOC_G_ISP_OVERLAY: - err = put_atomisp_overlay32(&karg.overlay, up); + err = put_atomisp_overlay32(&karg.overlay, p32); break; case ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP: - err = put_atomisp_calibration_group32(&karg.cal_grp, up); + err = put_atomisp_calibration_group32(&karg.cal_grp, p32); break; case ATOMISP_IOC_ACC_LOAD: - err = put_atomisp_acc_fw_load32(&karg.acc_fw_load, up); + err = put_atomisp_acc_fw_load32(&karg.acc_fw_load, p32); break; case ATOMISP_IOC_ACC_S_ARG: case ATOMISP_IOC_ACC_DESTAB: - err = put_atomisp_acc_fw_arg32(&karg.acc_fw_arg, up); + err = put_atomisp_acc_fw_arg32(&karg.acc_fw_arg, p32); break; case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: case ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA: - err = put_v4l2_private_int_data32(&karg.v4l2_pri_data, up); + err = put_v4l2_private_int_data32(&karg.v4l2_pri_data, p32); break; case ATOMISP_IOC_ACC_MAP: case ATOMISP_IOC_ACC_UNMAP: - err = put_atomisp_acc_map32(&karg.acc_map, up); + err = put_atomisp_acc_map32(&karg.acc_map, p32); break; case ATOMISP_IOC_ACC_S_MAPPED_ARG: - err = put_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, up); + err = put_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, p32); break; case ATOMISP_IOC_ACC_LOAD_TO_PIPE: err = put_atomisp_acc_fw_load_to_pipe32(&karg.acc_fw_to_pipe, - up); + p32); break; case ATOMISP_IOC_G_METADATA: - err = put_atomisp_metadata_stat32(&karg.md, up); + err = put_atomisp_metadata_stat32(&karg.md, p32); break; case ATOMISP_IOC_G_METADATA_BY_TYPE: err = put_atomisp_metadata_by_type_stat32(&karg.md_with_type, - up); + p32); break; } -- 2.26.2
prev parent reply other threads:[~2020-05-30 6:57 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-30 6:55 [PATCH v2 00/41] More atomisp fixes and cleanups Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 01/41] media: atomisp: simplify hive_isp_css_mm_hrt wrapper Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 02/41] media: atomisp: get rid of the hrt/hive_isp_css_mm_hrt abstraction layer Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 03/41] media: atomisp: reduce abstraction at ia_css_memory_access Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 04/41] media: atomisp: go one step further to drop ia_css_memory_access.c Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 05/41] media: atomisp: get rid of mmgr_load and mmgr_store Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 06/41] media: atomisp: get rid of unused memory_realloc code Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 07/41] media: atomisp: change the type returned by mmgr alloc Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 08/41] media: atomisp: get rid of memory_access.c Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 09/41] media: atomisp: hmm_bo: untag user pointers Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 10/41] media: atomisp: add debug message to help debugging hmm code Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 11/41] media: atomisp: use Yocto Aero default hmm pool sizes Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 12/41] media: atomisp: get rid of a warning message Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 13/41] media: atomisp: fix driver caps Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 14/41] media: atomisp: use pin_user_pages() for memory allocation Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 15/41] media: atomisp: add debug for hmm alloc Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 16/41] media: atomisp: improve warning for IRQ enable function Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 17/41] media: atomisp: add debug functions for received events Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 18/41] media: atomisp: add more comments about frame allocation Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 19/41] media: atomisp: remove kvmalloc/kvcalloc abstractions Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 20/41] media: atomisp: avoid OOPS due to non-existing ref_frames Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 21/41] media: atomisp: Clean up if block in sh_css_sp_init_stage Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 22/41] media: atomisp: Remove second increment of count in atomisp_subdev_probe Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 23/41] media: atomisp: Remove unnecessary NULL checks in ia_css_pipe_load_extension Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 24/41] media: atomisp: Remove unnecessary NULL check in atomisp_param Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 25/41] media: atomisp: Avoid overflow in compute_blending Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 26/41] media: atomisp: Remove binary_supports_input_format Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 27/41] media: atomisp: avoid an extra memset() when alloc memory Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 28/41] media: atomisp: remove some trivial wrappers from compat css20 Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 29/41] media: atomisp: do another round of coding style cleanup Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 31/41] media: atomisp: get rid of an error abstraction layer Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 32/41] media: atomisp: don't cause a warn if probe failed Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 33/41] media: atomisp: get rid of a bunch of other wrappers Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 34/41] media: atomisp: get rid of system_types.h Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 35/41] media: atomisp: provide more details about the firmware binaries Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 36/41] media: atomisp: print firmware data during load Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 37/41] media: atomisp: allow passing firmware name at modprobe time Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 38/41] media: atomisp: add a debug message at hmm free Mauro Carvalho Chehab 2020-05-30 6:55 ` [PATCH v2 39/41] media: atomisp: add some debug messages when binaries are used Mauro Carvalho Chehab 2020-05-30 6:55 ` Mauro Carvalho Chehab [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20234729bd1227640b0ba1976fec9e1121d3437c.1590821410.git.mchehab+huawei@kernel.org \ --to=mchehab+huawei@kernel.org \ --cc=devel@driverdev.osuosl.org \ --cc=gregkh@linuxfoundation.org \ --cc=hch@lst.de \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=sakari.ailus@linux.intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Unnamed repository; edit this file 'description' to name the repository. This inbox may be cloned and mirrored by anyone: git clone --mirror http://archive.lwn.net:8080/linux-media/0 linux-media/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-media linux-media/ http://archive.lwn.net:8080/linux-media \ linux-media@vger.kernel.org lwn-linux-media@archive.lwn.net public-inbox-index linux-media Example config snippet for mirrors. Newsgroup available over NNTP: nntp://archive.lwn.net/lwn.kernel.linux-media AGPL code for this site: git clone https://public-inbox.org/public-inbox.git