kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2] staging: lustre: prevent underflows in lnet_parse_reply()
@ 2015-04-01  8:13 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-04-01  8:13 UTC (permalink / raw)
  To: kernel-janitors

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>

diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c
index ed6eec9..9fe0c64 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) {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-01  8:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-01  8:13 [patch 2/2] staging: lustre: prevent underflows in lnet_parse_reply() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).