lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Feb 2015 21:35:44 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Andrey Utkin <andrey.krieger.utkin@...il.com>
Cc:	OSUOSL Drivers <devel@...verdev.osuosl.org>,
	kernel-mentors@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	noralf@...nnes.org
Subject: Re: [PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings

On Mon, Feb 23, 2015 at 07:06:44PM +0200, Andrey Utkin wrote:
> 2015-02-21 20:58 GMT+02:00 Dan Carpenter <dan.carpenter@...cle.com>:
> > Send two separate patches.  You can't "fix" sparse warnings.  You can
> > only "fix" bugs.  The rest is add annotation, doing cleanups or possibly
> > silencing warnings.
> 
> My first email wasn't a patch supposed for accepting, but rather a
> request for comments, so I didn't bother with commit granularity,
> separation of commit description and the description of my situation
> with scissors marker etc. Sorry if this is rude or confusing.

At least *try* to send proper patches.  It is a waste of time to send
half finished patches with lazy butt changelogs, yes.

> 
> 
> >> diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> index 9cc7d25..9114239 100644
> >> --- a/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
> >> @@ -273,7 +273,7 @@ construct_line_bitmap(struct fbtft_par *par, u8 *dest, signed short *src,
> >>
> >>  static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
> >>  {
> >> -     u16 *vmem16 = (u16 *)par->info->screen_base;
> >> +     u16 __iomem *vmem16 = (u16 __iomem *)par->info->screen_base;
> >
> > I haven't looked.  What is the type for ->screen_base and why can't it
> > be declared as __iomem type?
>
> http://lxr.free-electrons.com/source/include/linux/fb.h#L486
> screen_base is component of struct fb_info, defined as "char __iomem *".
> In drivers/staging/fbtft/fbtft-core.c, it looks to be actually set to
> a pointer resulting from vzalloc().

Hm, you're right.  Normally, it's an __iomem * but this time it's not
an __iomem pointer.  Adding anotations to mark it as __iomem is wrong
and adding calls to ioread16() is buggy.

There are a couple ways to make these warnings go away.  The simplest
is just to silence the warning with __force:

	u16 *vmem16 = (u16 __force *)par->info->screen_base;

I'm not terribly familiar with this code.  I don't know that this is the
cleanest approach.  We could also just leave the code alone for now and
ignore the warning.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists