From: Dan Carpenter Date: Wed, 1 Apr 2015 08:13:03 +0000 (+0300) Subject: staging: lustre: prevent underflows in lnet_parse_reply() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=005b23d6b6e7e798b6799bedffc60f33494058ea;p=openwrt%2Fstaging%2Fblogic.git staging: lustre: prevent underflows in lnet_parse_reply() I don't know if "hdr->payload_length;" can really be negative, but if so then we shouldn't allow it. Do the comparison as an unsigned. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 0f53c761f1a9..c2fb70e5fc4e 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -1530,7 +1530,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) LASSERT(md->md_offset == 0); rlength = hdr->payload_length; - mlength = min_t(int, rlength, md->md_length); + mlength = min_t(uint, rlength, md->md_length); if (mlength < rlength && (md->md_options & LNET_MD_TRUNCATE) == 0) {