[PATCH 06/20] staging/lustre: fix comparison between signed and unsigned

From: green
Date: Sun Feb 01 2015 - 21:55:58 EST


From: Dmitry Eremin <dmitry.eremin@xxxxxxxxx>

Expression if (size != (ssize_t)size) is always false.
Therefore no bounds check errors detected.

Signed-off-by: Dmitry Eremin <dmitry.eremin@xxxxxxxxx>
Reviewed-on: http://review.whamcloud.com/11376
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5417
Reviewed-by: John L. Hammond <john.hammond@xxxxxxxxx>
Reviewed-by: Fan Yong <fan.yong@xxxxxxxxx>
Signed-off-by: Oleg Drokin <oleg.drokin@xxxxxxxxx>
---
drivers/staging/lustre/lustre/include/lustre/lustre_user.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 89794fd..176bd46 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -1012,7 +1012,7 @@ static inline ssize_t hur_len(struct hsm_user_request *hur)
(__u64)hur->hur_request.hr_itemcount *
sizeof(hur->hur_user_item[0]) + hur->hur_request.hr_data_len;

- if (size != (ssize_t)size)
+ if (size > ~((size_t)0)>>1)
return -1;

return size;
--
2.1.0

--
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/