[PATCH 4/4] staging: lustre: Fix potential buffer underflow

From: Hugues Morisset
Date: Mon Sep 08 2014 - 16:59:04 EST


Signed-off-by: Hugues Morisset <morisset.hugues@xxxxxxxxx>
---
drivers/staging/lustre/lustre/include/obd.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 409eae6..bb67e40 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -677,7 +677,12 @@ static inline int is_osp_on_mdt(char *name)
if (strncmp(ptr + 1, "MDT", 3) != 0)
return 0;

- while (*(--ptr) != '-' && ptr != name);
+ if (ptr == name)
+ return 0;
+
+ --ptr;
+ while (ptr != '-' && ptr != name)
+ --ptr;

if (ptr == name)
return 0;
--
2.1.0


--------------010204070902090403060208--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/