[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1422567431-5324-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Thu, 29 Jan 2015 22:37:11 +0100
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>
Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dmitry Eremin <dmitry.eremin@...el.com>,
Eddie Kovsky <ewk@...ovsky.org>, Anil Belur <askb23@...il.com>,
HPDD-discuss@...ts.01.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] staging: lustre: fid: lproc_fid: Improving error control
Improving error checking by now use a return value from sscanf.
This was found using a static code analysis program called cppcheck
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
---
drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index 6a21f07..9b4ada4 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -85,7 +85,7 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
rc = sscanf(kernbuf, "[%llx - %llx]\n",
(unsigned long long *)&tmp.lsr_start,
(unsigned long long *)&tmp.lsr_end);
- if (!range_is_sane(&tmp) || range_is_zero(&tmp) ||
+ if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp) ||
tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end)
return -EINVAL;
*range = tmp;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists