Skip to contentSkip to conversation

iscsi: change & to &&

PATCH In review Dan Carpenter 2 participants 2 messages Mar 8, 2010

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

PATCH 1/1 iscsi: change & to &&

This change is basically a clean up.

datadgst_en is an int which comes from the user. I didn't see anything limiting it to 1 and 0 although obviously that's what it's supposed to be. If the user passed in 2 this test would fail.

This same if condition is repeated in another function and it uses && there.

drivers/scsi/libiscsi_tcp.c +1 -1
index 4ad87fd..3794d29 100644
@@ -420,7 +420,7 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 	struct iscsi_conn *conn = tcp_conn->iscsi_conn;
 	struct hash_desc *rx_hash = NULL;
 
-	if (conn->datadgst_en &
+	if (conn->datadgst_en &&
 	    !(conn->session->tt->caps & CAP_DIGEST_OFFLOAD))
 		rx_hash = tcp_conn->rx_hash;
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dan Carpenter

This change is basically a clean up.

datadgst_en is an int which comes from the user. I didn't see anything limiting it to 1 and 0 although obviously that's what it's supposed to be. If the user passed in 2 this test would fail.

This same if condition is repeated in another function and it uses&& there.

drivers/scsi/libiscsi_tcp.c +0 -0
index 4ad87fd..3794d29 100644

drivers/scsi/libiscsi_tcp.c iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn) · line 426

Quoted 8 lines
drivers/scsi/libiscsi_tcp.c +1 -1
@@ -420,7 +420,7 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
  	struct iscsi_conn *conn = tcp_conn->iscsi_conn;
  	struct hash_desc *rx_hash = NULL;
 
-	if (conn->datadgst_en&
+	if (conn->datadgst_en&&
  	!(conn->session->tt->caps&  CAP_DIGEST_OFFLOAD))
  		rx_hash = tcp_conn->rx_hash;
 

Doh. Thanks!