Skip to contentSkip to conversation

caif: fix a couple range checks

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 7, 2010 – Jun 9, 2010

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

PATCH 1/1 caif: fix a couple range checks

The extra ! character means that these conditions are always false.

net/caif/cfveil.c +1 -1
index 0fd827f..e04f7d9 100644
@@ -84,7 +84,7 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt)
 		return ret;
 	caif_assert(layr->dn != NULL);
 	caif_assert(layr->dn->transmit != NULL);
-	if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
+	if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
 		pr_warning("CAIF: %s(): Packet too large - size=%d\n",
 			   __func__, cfpkt_getlen(pkt));
 		return -EOVERFLOW;
net/caif/cfrfml.c +1 -1
index cd2830f..fd27b17 100644
@@ -83,7 +83,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
 	if (!cfsrvl_ready(service, &ret))
 		return ret;
 
-	if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
+	if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
 		pr_err("CAIF: %s():Packet too large - size=%d\n",
 			__func__, cfpkt_getlen(pkt));
 		return -EOVERFLOW;
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines

From: Dan Carpenter [mailto:[email protected]]

The extra ! character means that these conditions are always false.

Looks good, thanks. This is embarrassing, I should caught this ages ago.

Quoted 31 lines
net/caif/cfveil.c +1 -1
index 0fd827f..e04f7d9 100644
@@ -84,7 +84,7 @@ static int cfvei_transmit(struct cflayer *layr,
 struct cfpkt *pkt)
 		return ret;
 	caif_assert(layr->dn != NULL);
 	caif_assert(layr->dn->transmit != NULL);
-	if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
+	if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
 		pr_warning("CAIF: %s(): Packet too large - size=%d\n",
 			   __func__, cfpkt_getlen(pkt));
net/caif/cfveil.c +0 -0
 		return -EOVERFLOW;
net/caif/cfrfml.c +1 -1
index cd2830f..fd27b17 100644
@@ -83,7 +83,7 @@ static int cfrfml_transmit(struct cflayer *layr,
 struct cfpkt *pkt)
 	if (!cfsrvl_ready(service, &ret))
 		return ret;
 
-	if (!cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
+	if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
 		pr_err("CAIF: %s():Packet too large - size=%d\n",
 			__func__, cfpkt_getlen(pkt));

return -EOVERFLOW;