diff options
| author | Serhat Kumral <serhatkumral1@gmail.com> | 2026-10-02 19:56:41 +0300 |
|---|---|---|
| committer | Alison Schofield <alison.schofield@intel.com> | 2026-10-15 16:19:17 -0700 |
| commit | c0962f508e80d73aab8406b716496d40eb4bfc14 (patch) | |
| tree | 65266e9e8ca551c204953928e7f8d248e17929c6 /tools/lib/python/kdoc | |
| parent | 855a46681e0ba601952c346e5b62d867e51ecb23 (diff) | |
libnvdimm: Handle negative return from nvdimm_clear_poison() in nsio_rw_bytes()
When nvdimm_clear_poison() fails, it returns a negative error code.
However, 'cleared' is a signed long while 'size' is size_t.
The comparison 'cleared < size' promotes 'cleared' to an unsigned long.
So the error condition can be bypassed and the function can
incorrectly return success if the subsequent flush succeeds.
Explicitly check for negative error codes before comparing with 'size'.
Fixes: 868f036fee4b ("libnvdimm: fix mishandled nvdimm_clear_poison() return value")
Assisted-by: LLM
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/all/90d3d353-28e9-4f6d-b141-a9b7157d5514@moroto.mountain/
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20261002165641.14479-1-serhatkumral1@gmail.com
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions
