From aaa808e7a40198581956a1d648f413cc30e830ed Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Thu, 19 Oct 2017 10:14:18 +0200 Subject: [PATCH 1/1] LU-10141 llapi: integer overflow in llapi_changelog_start Use the appropriate type to store and check the return value from lseek. This prevents from misinterpreting high offsets as errors. Change-Id: I15e92be3454af20ee6611c2a7ddfc1b597d639c2 Signed-off-by: Henri Doreau Reviewed-on: https://review.whamcloud.com/29674 Tested-by: Jenkins Reviewed-by: Thomas LEIBOVICI Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Stephan Thiell Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi_chlg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lustre/utils/liblustreapi_chlg.c b/lustre/utils/liblustreapi_chlg.c index f4661be..d9c7af0 100644 --- a/lustre/utils/liblustreapi_chlg.c +++ b/lustre/utils/liblustreapi_chlg.c @@ -117,8 +117,10 @@ int llapi_changelog_start(void **priv, enum changelog_send_flag flags, } if (startrec != 0) { - rc = lseek(cp->clp_fd, startrec, SEEK_SET); - if (rc < 0) { + off_t res; + + res = lseek(cp->clp_fd, startrec, SEEK_SET); + if (res == (off_t)-1) { rc = -errno; goto out_close; } -- 1.8.3.1