Skip to content

Commit

Permalink
staging: lustre: prevent underflows in lnet_parse_reply()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 3, 2015
1 parent faec8ab commit 005b23d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lnet/lnet/lib-move.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 005b23d

Please sign in to comment.