mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Rand Deeb <rand.sec96@gmail.com>
Cc: <stable@vger.kernel.org>, <axboe@kernel.dk>,
	<linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<deeb.rand@confident.ru>, <lvc-project@linuxtesting.org>,
	<khoroshilov@ispras.ru>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>
Subject: Re: [PATCH 5.10.y] ata: pata_sil680: fix result type of sil680_sel{dev|reg}()
Date: Tue, 28 Apr 2026 20:50:32 +0300	[thread overview]
Message-ID: <756c03d6-d36a-4774-88ff-635e9f8a1437@omp.ru> (raw)
In-Reply-To: <CAN8dotkWCxBT-Sg=Sv+nbZCdTD=DWoHL=Kb2atFoo2KgcCjzSQ@mail.gmail.com>

On 4/28/26 11:15 AM, Rand Deeb wrote:

[...]

>>> From: Sergey Shtylyov <s.shtylyov@omp.ru>
>>>
>>> [ Upstream commit dafbbf5c57dd6ae01d20b894bc2200e9d9834c4e ]
>>>
>>> sil680_sel{dev|reg}() return a PCI config space address but needlessly
>>> use the *unsigned long* type for that,  whereas the PCI config space
>>> accessors take *int* for the address parameter.  Switch these functions
>>> to returning *int*, updating the local variables at their call sites.
>>> Get rid of the 'base' local variables in these functions, while at it...
>>>
>>> Found by Linux Verification Center (linuxtesting.org) with the SVACE static
>>> analysis tool.
>>>
>>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
>>> Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
>>> ---
>>>  drivers/ata/pata_sil680.c | 30 +++++++++++++-----------------
>>>  1 file changed, 13 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
>>> index 7ab9aea3b..fe60f884b 100644
>>> --- a/drivers/ata/pata_sil680.c
>>> +++ b/drivers/ata/pata_sil680.c
>>> @@ -47,11 +47,9 @@
>>>   *     criticial.
>>>   */
>>>
>>> -static unsigned long sil680_selreg(struct ata_port *ap, int r)
>>> +static int sil680_selreg(struct ata_port *ap, int r)
>>>  {
>>> -       unsigned long base = 0xA0 + r;
>>> -       base += (ap->port_no << 4);
>>> -       return base;
>>> +       return 0xA0 + (ap->port_no << 4) + r;
>>>  }
>>>
>>>  /**
>>> @@ -64,12 +62,9 @@ static unsigned long sil680_selreg(struct ata_port *ap, int r)
>>>   *     the unit shift.
>>>   */
>>>
>>> -static unsigned long sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)
>>> +static int sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)
>>>  {
>>> -       unsigned long base = 0xA0 + r;
>>> -       base += (ap->port_no << 4);
>>> -       base |= adev->devno ? 2 : 0;
>>> -       return base;
>>> +       return 0xA0 + (ap->port_no << 4) + r + (adev->devno << 1);
>>>  }
>>
>>    And why exactly is this needed in 5.10.y?
>>
>> [...]
>> MBR, Sergey
>>
> 
> Hi Sergey,
> 
> This is a direct backport of upstream commit dafbbf5c57dd.

   I figured. :-)

> It fixes a type mismatch between the helper functions and the
> PCI config accessors (which expect int), as identified by
> static analysis (SVACE).

   Thank you for reminding me what my patch does... :-)

> The intent is to keep the code consistent and avoid issues
> flagged by tooling.

   What tooling, Svace?

> If this is not considered appropriate for 5.10.y, I’m fine
> with dropping it.

   If I considered this a fix for something, I'd have added
the Fixes tag -- then it would be worthy of backporting. Now
it's not, I think...

> Thanks

MBR, Sergey


      reply	other threads:[~2026-04-28 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-19 22:23 Rand Deeb
2026-04-20 13:10 ` Sergey Shtylyov
2026-04-28  8:15   ` Rand Deeb
2026-04-28 17:50     ` Sergey Shtylyov [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=756c03d6-d36a-4774-88ff-635e9f8a1437@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=deeb.rand@confident.ru \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=rand.sec96@gmail.com \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®