All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [bug report] bus: ti-sysc: Fix module register ioremap for larger offsets
Date: Wed, 22 Aug 2018 14:29:49 +0000	[thread overview]
Message-ID: <20180822142949.GA94926@atomide.com> (raw)
In-Reply-To: <20180822132258.rh5u5kenlx2anuvs@kili.mountain>

Hi,

* Dan Carpenter <dan.carpenter@oracle.com> [180822 13:26]:
> Hello Tony Lindgren,
> 
> The patch 7180c523efca: "bus: ti-sysc: Fix module register ioremap
> for larger offsets" from Aug 8, 2018, leads to the following static
> checker warning:
> 
> 	drivers/bus/ti-sysc.c:518 sysc_ioremap()
> 	warn: unsigned 'size' is never less than zero.

Thanks for catching it, we should use int here instead of u32.

>    510  static int sysc_ioremap(struct sysc *ddata)
>    511  {
>    512          u32 size;
>    513  
>    514          size = max3(ddata->offsets[SYSC_REVISION],
>    515                      ddata->offsets[SYSC_SYSCONFIG],
>    516                      ddata->offsets[SYSC_SYSSTATUS]);
>    517  
>    518          if (size < 0)
>                     ^^^^^^^^
> It's weird that we don't trust the offsets.  Can the += 4 overflow?

Some registers may not exist or can be at offset 0 so we use -ENODEV
too. If no registers are found it's a dts configuration error for sure.

Checking for overflow is a good idea. It could happen with misconfigured
dts file if a reg is past the module sizez. I'll be posting v2 of the
patch.

Regards,

Tony

      reply	other threads:[~2018-08-22 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 13:22 [bug report] bus: ti-sysc: Fix module register ioremap for larger offsets Dan Carpenter
2018-08-22 14:29 ` Tony Lindgren [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=20180822142949.GA94926@atomide.com \
    --to=tony@atomide.com \
    --cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.