Bug 195785 - Possible unintended usage of "p" variable
Summary: Possible unintended usage of "p" variable
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: James Simmons
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-16 07:50 UTC by Petru-Florin Mihancea
Modified: 2017-05-31 18:14 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.12-rc1
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Petru-Florin Mihancea 2017-05-16 07:50:25 UTC
Hi,

While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file "drivers/ata/libata-core.c" line 6803:

force_ent->port = simple_strtoul(id, &endp, 10);
if (p == endp || *endp != '\0') { 

In the first check of the if statement, shouldn't the "id" variable be checked (instead of "p")? As can be observed, the proper conversion of "id" should be verified.
Comment 1 Tejun Heo 2017-05-31 17:17:49 UTC
Indeed. Care to submit a patch?
Comment 2 Petru-Florin Mihancea 2017-05-31 18:14:46 UTC
No, thanks for asking :). You can fix it directly. Thanks again.

Note You need to log in before you can comment on or make changes to this bug.