Coverity: calibrate_8976(): Memory - illegal accesses
Hello!
This is an experimental automated report about issues detected by Coverity from a scan of next-20191025 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified lines of code (noted below) that were touched by recent commits:
95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")
Coverity reported the following:
*** CID 1487355: Memory - illegal accesses (USE_AFTER_FREE) /drivers/thermal/qcom/tsens-v1.c: 245 in calibrate_8976()
239 int mode = 0, tmp = 0;
240 u32 *qfprom_cdata;
241
242 qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
243 if (IS_ERR(qfprom_cdata)) {
244 kfree(qfprom_cdata);
vvv CID 1487355: Memory - illegal accesses (USE_AFTER_FREE)
vvv Passing freed pointer "qfprom_cdata" as an argument to "PTR_ERR".
245 return PTR_ERR(qfprom_cdata);
246 }247
248 mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK);
249 dev_dbg(priv->dev, "calibration mode is %d\n", mode);
250
If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include:
Addresses-Coverity-ID: 1487355 ("Memory - illegal accesses")
Thanks for your attention!
Signature · 1 line
Coverity-bot
Hi,
This one has been addressed already:
https://lore.kernel.org/lkml/CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com/
Thanks
--
Gustavo
Quoted 42 lines · coverity-bot
Hello!
This is an experimental automated report about issues detected by Coverity from a scan of next-20191025 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scanYou're getting this email because you were associated with the identified lines of code (noted below) that were touched by recent commits:
95ededc17e4e("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Coverity reported the following:
*** CID 1487355: Memory - illegal accesses (
USE_AFTER_FREE) /drivers/thermal/qcom/tsens-v1.c: 245 incalibrate_8976()
239 int mode = 0, tmp = 0;
240 u32*qfprom_cdata;
241242 qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib"); 243 if (IS_ERR(qfprom_cdata)) { 244 kfree(qfprom_cdata); vvv CID 1487355: Memory - illegal accesses (USE_AFTER_FREE) vvv Passing freed pointer "qfprom_cdata" as an argument to "PTR_ERR". 245 return PTR_ERR(qfprom_cdata); 246 }247
248 mode = (qfprom_cdata[4] &MSM8976_CAL_SEL_MASK);
249dev_dbg(priv->dev, "calibration mode is %d\n", mode);
250If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include:
Reported-by coverity-bot <[email protected]>Addresses-Coverity-ID: 1487355 ("Memory - illegal accesses")
Fixes 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Thanks for your attention!
Quoted 7 lines · Gustavo A. R. Silva
Hi,
This one has been addressed already:
https://lore.kernel.org/lkml/CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com/
Ah-ha, excellent. Colin, do you want me to CC you on these automatic reports too?
-Kees
Quoted 47 lines
Thanks
--
GustavoQuoted 42 lines · coverity-bot
Hello!
This is an experimental automated report about issues detected by Coverity from a scan of next-20191025 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scanYou're getting this email because you were associated with the identified lines of code (noted below) that were touched by recent commits:
95ededc17e4e("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Coverity reported the following:
*** CID 1487355: Memory - illegal accesses (
USE_AFTER_FREE) /drivers/thermal/qcom/tsens-v1.c: 245 incalibrate_8976()
239 int mode = 0, tmp = 0;
240 u32*qfprom_cdata;
241
242qfprom_cdata= (u32 *)qfprom_read(priv->dev, "calib");
243 if (IS_ERR(qfprom_cdata)) {
244kfree(qfprom_cdata);
vvv CID 1487355: Memory - illegal accesses (USE_AFTER_FREE)
vvv Passing freed pointer "qfprom_cdata" as an argument to "PTR_ERR".
245 returnPTR_ERR(qfprom_cdata);
246 }
247
248 mode = (qfprom_cdata[4] &MSM8976_CAL_SEL_MASK);
249dev_dbg(priv->dev, "calibration mode is %d\n", mode);
250If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include:
Reported-by coverity-bot <[email protected]>Addresses-Coverity-ID: 1487355 ("Memory - illegal accesses")
Fixes 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Thanks for your attention!
Signature · 1 line
Kees Cook
Quoted 6 lines · Kees Cook
Quoted 3 lines · Gustavo A. R. Silva
Hi,
Quoted 8 lines
Quoted 4 lines
This one has been addressed already:
https://lore.kernel.org/lkml/CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com/
Ah-ha, excellent. Colin, do you want me to CC you on these automatic reports too?
Hi Kees,
Is coverity being run just on linux-next or on mainline too? I've noticed it found at least one error that has existed for a long-time only when that code was moved around.
Regards,
Amit
Quoted 48 lines
Quoted 36 lines · coverity-bot
Quoted 35 lines
Hello!
This is an experimental automated report about issues detected by Coverity from a scan of next-20191025 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scanYou're getting this email because you were associated with the identified lines of code (noted below) that were touched by recent commits:
95ededc17e4e("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Coverity reported the following:
*** CID 1487355: Memory - illegal accesses (
USE_AFTER_FREE) /drivers/thermal/qcom/tsens-v1.c: 245 incalibrate_8976()
239 int mode = 0, tmp = 0;
240 u32*qfprom_cdata;
241
242qfprom_cdata= (u32 *)qfprom_read(priv->dev, "calib");
243 if (IS_ERR(qfprom_cdata)) {
244kfree(qfprom_cdata);
vvv CID 1487355: Memory - illegal accesses (USE_AFTER_FREE)
vvv Passing freed pointer "qfprom_cdata" as an argument to "PTR_ERR".
245 returnPTR_ERR(qfprom_cdata);
246 }
247
248 mode = (qfprom_cdata[4] &MSM8976_CAL_SEL_MASK);
249dev_dbg(priv->dev, "calibration mode is %d\n", mode);
250If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include:
Quoted 7 lines
Quoted 7 lines
Reported-by coverity-bot <[email protected]>Addresses-Coverity-ID: 1487355 ("Memory - illegal accesses")
Fixes 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")Thanks for your attention!
--
Kees Cook
Quoted 16 lines · Amit Kucheria
Quoted 6 lines · Kees Cook
Quoted 3 lines · Gustavo A. R. Silva
Hi,
Quoted 8 lines
Quoted 4 lines
This one has been addressed already:
https://lore.kernel.org/lkml/CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com/
Ah-ha, excellent. Colin, do you want me to CC you on these automatic reports too?
Quoted 5 lines
Hi Kees,
Is coverity being run just on linux-next or on mainline too? I've noticed it found at least one error that has existed for a long-time only when that code was moved around.
There is another public Coverity scan that runs the -rcX releases. Dave Jones tends to operate that one, and I haven't attached any tooling to that one. I wanted to see how noisy running against linux-next was first...
Signature · 1 line
Kees Cook