From: Hans Zhang <18255117159@163.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: lpieralisi@kernel.org, jingoohan1@gmail.com,
kwilczynski@kernel.org, bhelgaas@google.com, robh@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: dwc: Fix type mismatch for kstrtou32_from_user return value
Date: Wed, 1 Apr 2026 22:01:06 +0800 [thread overview]
Message-ID: <976e1e32-d671-42f4-8a11-3308013feb02@163.com> (raw)
In-Reply-To: <e55eajqhjh4hgpgzlm4cr6lh5sw6eulkgn2iy53blwmttr7hq3@ndoeigvy2v3q>
On 4/1/26 20:27, Manivannan Sadhasivam wrote:
> On Wed, Apr 01, 2026 at 10:30:48AM +0800, Hans Zhang wrote:
>> kstrtou32_from_user() returns int, but the return value was stored in
>> a u32 variable 'val', risking sign loss. Use a dedicated int variable
>> to correctly handle the return code.
>>
>> Signed-off-by: Hans Zhang <18255117159@163.com>
>
> Can you add Fixes tag also?
>
Hi Mani,
Sorry, below is the "Fixes" tag that I found. Could it be that you added
it when receiving the patch? Or do I need to send the v2 version?
Fixes: 4fbfa17f9a07 ("PCI: dwc: Add debugfs based Silicon Debug support
for DWC")
Best regards,
Hans
> - Mani
>
>> ---
>> .../controller/dwc/pcie-designware-debugfs.c | 21 +++++++++++--------
>> 1 file changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
>> index 0d1340c9b364..9461be074490 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
>> @@ -208,10 +208,11 @@ static ssize_t lane_detect_write(struct file *file, const char __user *buf,
>> struct dw_pcie *pci = file->private_data;
>> struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;
>> u32 lane, val;
>> + int ret;
>>
>> - val = kstrtou32_from_user(buf, count, 0, &lane);
>> - if (val)
>> - return val;
>> + ret = kstrtou32_from_user(buf, count, 0, &lane);
>> + if (ret)
>> + return ret;
>>
>> val = dw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + SD_STATUS_L1LANE_REG);
>> val &= ~(LANE_SELECT);
>> @@ -347,10 +348,11 @@ static ssize_t counter_enable_write(struct file *file, const char __user *buf,
>> struct dw_pcie *pci = pdata->pci;
>> struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;
>> u32 val, enable;
>> + int ret;
>>
>> - val = kstrtou32_from_user(buf, count, 0, &enable);
>> - if (val)
>> - return val;
>> + ret = kstrtou32_from_user(buf, count, 0, &enable);
>> + if (ret)
>> + return ret;
>>
>> mutex_lock(&rinfo->reg_event_lock);
>> set_event_number(pdata, pci, rinfo);
>> @@ -408,10 +410,11 @@ static ssize_t counter_lane_write(struct file *file, const char __user *buf,
>> struct dw_pcie *pci = pdata->pci;
>> struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;
>> u32 val, lane;
>> + int ret;
>>
>> - val = kstrtou32_from_user(buf, count, 0, &lane);
>> - if (val)
>> - return val;
>> + ret = kstrtou32_from_user(buf, count, 0, &lane);
>> + if (ret)
>> + return ret;
>>
>> mutex_lock(&rinfo->reg_event_lock);
>> set_event_number(pdata, pci, rinfo);
>>
>> base-commit: 9147566d801602c9e7fc7f85e989735735bf38ba
>> --
>> 2.34.1
>>
>
next prev parent reply other threads:[~2026-04-01 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 2:30 Hans Zhang
2026-04-01 12:27 ` Manivannan Sadhasivam
2026-04-01 14:01 ` Hans Zhang [this message]
2026-04-02 17:38 ` Manivannan Sadhasivam
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=976e1e32-d671-42f4-8a11-3308013feb02@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@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®