public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH 18/21] media: isppreview: fix __user annotations
Date: Fri, 6 Apr 2018 13:22:51 -0300	[thread overview]
Message-ID: <20180406132251.72b5f5c3@vento.lan> (raw)
In-Reply-To: <9078125.KNKj9j4yVL@avalon>

Em Fri, 06 Apr 2018 18:54:50 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Mauro,
> 
> Thank you for the patch.
> 
> On Friday, 6 April 2018 17:23:19 EEST Mauro Carvalho Chehab wrote:
> > That prevent those warnings:
> >    drivers/media/platform/omap3isp/isppreview.c:893:45: warning: incorrect
> > type in initializer (different address spaces)
> > drivers/media/platform/omap3isp/isppreview.c:893:45:    expected void
> > [noderef] <asn:1>*from drivers/media/platform/omap3isp/isppreview.c:893:45:
> >    got void *[noderef] <asn:1><noident>
> > drivers/media/platform/omap3isp/isppreview.c:893:47: warning: dereference
> > of noderef expression  
> 
> That's nice, but it would be even nicer to explain what the problem is and how 
> you fix it, otherwise one might be left wondering if the fix is correct, or if 
> it could be a false positive.

Ok. Please see the enclosed patch.

> With the commit message updated,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Thanks,
Mauro

[PATCH] media: isppreview: fix __user annotations

The 'from' variable at preview_config() expects an __user * type.

However, the logic there does:

    from = *(void * __user *) ((void *)cfg + attr->config_offset);

With actually means a void pointer, pointing to a void __ user
pointer. When the first pointer is de-referenced with *(foo),
the type it returns is "void *" instead of "void __user *".

Change it to:
    from = *(void __user **) ((void *)cfg + attr->config_offset);

in order to obtain, when de-referenced, a void __user pointer,
as desired.

That prevent those warnings:
   drivers/media/platform/omap3isp/isppreview.c:893:45: warning: incorrect type in initializer (different address spaces)
   drivers/media/platform/omap3isp/isppreview.c:893:45:    expected void [noderef] <asn:1>*from
   drivers/media/platform/omap3isp/isppreview.c:893:45:    got void *[noderef] <asn:1><noident>
   drivers/media/platform/omap3isp/isppreview.c:893:47: warning: dereference of noderef expression

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index ac30a0f83780..c2ef5870b231 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -890,7 +890,7 @@ static int preview_config(struct isp_prev_device *prev,
 		params = &prev->params.params[!!(active & bit)];
 
 		if (cfg->flag & bit) {
-			void __user *from = *(void * __user *)
+			void __user *from = *(void __user **)
 				((void *)cfg + attr->config_offset);
 			void *to = (void *)params + attr->param_offset;
 			size_t size = attr->param_size;

  reply	other threads:[~2018-04-06 16:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 14:23 [PATCH 00/21] Fix sparse/smatch errors on non-x86 drivers Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 01/21] media: davinci_vpfe: remove useless checks from ipipe Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 02/21] media: dm365_ipipe: remove an unused var Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 03/21] media: davinci_vpfe: fix vpfe_ipipe_init() error handling Mauro Carvalho Chehab
2018-10-09  4:46   ` Joel Fernandes
2018-10-11 16:56     ` Joel Fernandes
2018-04-06 14:23 ` [PATCH 04/21] media: davinci_vpfe: mark __iomem as such Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 05/21] media: davinci_vpfe: get rid of an unused var at dm365_isif.c Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 06/21] media: davinci_vpfe: vpfe_video: remove an unused var Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 07/21] media: davinci_vpfe: don't use kernel-doc markup for simple comments Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 08/21] media: davinci_vpfe: fix a typo for "default" Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 09/21] media: davinci_vpfe: cleanup ipipe_[g|s]_config logic Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 10/21] media: davinci_vpfe: fix __user annotations Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 11/21] media: si470x: fix __be16 annotations Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 12/21] media: isif: reorder a statement to match coding style Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 13/21] media: davinci: fix an inconsistent ident Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 14/21] media: mmp-driver: add needed __iomem marks to power_regs Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 15/21] media: vpbe_display: properly handle error case Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 16/21] media: vpbe_display: get rid of warnings Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 17/21] media: ispstat: use %p to print the address of a buffer Mauro Carvalho Chehab
2018-04-06 15:46   ` Laurent Pinchart
2018-04-06 16:24     ` Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 18/21] media: isppreview: fix __user annotations Mauro Carvalho Chehab
2018-04-06 15:54   ` Laurent Pinchart
2018-04-06 16:22     ` Mauro Carvalho Chehab [this message]
2018-04-06 14:23 ` [PATCH 19/21] media: fsl-viu: use %p to print pointers Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 20/21] media: fsl-viu: fix __iomem annotations Mauro Carvalho Chehab
2018-04-06 14:23 ` [PATCH 21/21] media: omap_vout: fix wrong identing Mauro Carvalho Chehab

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=20180406132251.72b5f5c3@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox