Skip to contentSkip to conversation

mpt fusion: declare some sizes as unsigned

PATCH New Dan Carpenter 1 participant 1 message Nov 1, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpt fusion: declare some sizes as unsigned

In mptctl_do_mpt_command() we cap the upper bound of .maxSenseBytes but we don't check for negative values:

if (karg.maxSenseBytes > MPT_SENSE_BUFFER_SIZE)

I've fixed this by making the type unsigned and I changed the surrounding types to match as well.

drivers/message/fusion/mptctl.h +10 -10
index d564cc9..9ea5a18 100644
@@ -324,11 +324,11 @@ struct mpt_ioctl_command {
 	char		__user *dataInBufPtr;
 	char		__user *dataOutBufPtr;
 	char		__user *senseDataPtr;
-	int		maxReplyBytes;
-	int		dataInSize;
-	int		dataOutSize;
-	int		maxSenseBytes;
-	int		dataSgeOffset;
+	u32		maxReplyBytes;
+	u32		dataInSize;
+	u32		dataOutSize;
+	u32		maxSenseBytes;
+	u32		dataSgeOffset;
 	char		MF[1];
 };
 
@@ -343,11 +343,11 @@ struct mpt_ioctl_command32 {
 	u32	dataInBufPtr;
 	u32	dataOutBufPtr;
 	u32	senseDataPtr;
-	int	maxReplyBytes;
-	int	dataInSize;
-	int	dataOutSize;
-	int	maxSenseBytes;
-	int	dataSgeOffset;
+	u32	maxReplyBytes;
+	u32	dataInSize;
+	u32	dataOutSize;
+	u32	maxSenseBytes;
+	u32	dataSgeOffset;
 	char	MF[1];
 };
 #endif	/*}*/