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

green
2015-02-02T02:53:21Z

From: Dmitry Eremin <dmitry.eremin@intel.com>

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

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
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@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
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