diff mbox

[39/39] libmultipath/discovery.c: Fixup possible range overflow

Message ID 1466070465-1021-40-git-send-email-hare@suse.de (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Hannes Reinecke June 16, 2016, 9:47 a.m. UTC
When checking the maximum value for dev_loss_tmo we need to
use a larger type, otherwise the comparison will always be false.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 libmultipath/discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 5d5441d..126a54f 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -670,7 +670,7 @@  sysfs_set_scsi_tmo (struct multipath *mpp)
 	int dev_loss_tmo = mpp->dev_loss;
 
 	if (mpp->no_path_retry > 0) {
-		int no_path_retry_tmo = mpp->no_path_retry * conf->checkint;
+		uint64_t no_path_retry_tmo = mpp->no_path_retry * conf->checkint;
 
 		if (no_path_retry_tmo > MAX_DEV_LOSS_TMO)
 			no_path_retry_tmo = MAX_DEV_LOSS_TMO;