Skip to contentSkip to conversation

cxl/mbox: fix logical vs bitwise typo

PATCH In review Dan Carpenter 3 participants 4 messages Apr 28, 2022 – May 6, 2022

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

PATCH 1/1 cxl/mbox: fix logical vs bitwise typo

This should be bitwise & instead of &&.

Fixes 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
---
 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/mbox.c +1 -1
index 731cb43b570e..54f434733b56 100644
@@ -243,7 +243,7 @@ static bool cxl_payload_from_user_allowed(u16 opcode, void *payload_in)
 	case CXL_MBOX_OP_SET_PARTITION_INFO: {
 		struct cxl_mbox_set_partition_info *pi = payload_in;
 
-		if (pi->flags && CXL_SET_PARTITION_IMMEDIATE_FLAG)
+		if (pi->flags & CXL_SET_PARTITION_IMMEDIATE_FLAG)
 			return false;
 		break;
 	}
Signature · 1 line
2.35.1
maintainer
#2 lore raw
In reply to Dan Carpenter
Quoted 1 line · Dan Carpenter

This should be bitwise & instead of &&.

Thanks Dan. How'd you find this?

Quoted 23 lines
Fixes 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
---
 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/mbox.c +1 -1
index 731cb43b570e..54f434733b56 100644
@@ -243,7 +243,7 @@ static bool cxl_payload_from_user_allowed(u16 opcode, void *payload_in)
 	case CXL_MBOX_OP_SET_PARTITION_INFO: {
 		struct cxl_mbox_set_partition_info *pi = payload_in;
 
-		if (pi->flags && CXL_SET_PARTITION_IMMEDIATE_FLAG)
+		if (pi->flags & CXL_SET_PARTITION_IMMEDIATE_FLAG)
 			return false;
 		break;
 	}
Signature · 1 line
2.35.1
#3 lore raw
Quoted 5 lines · Alison Schofield
Quoted 1 line · Dan Carpenter

This should be bitwise & instead of &&.

Thanks Dan. How'd you find this?

Sorry for the delayed response. This was from some Smatch work that I hadn't published yet. I've pushed it now.

It doesn't find anything else though.

regards,
dan carpenter

Quoted 23 lines
Quoted 23 lines
Fixes 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
---
 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/mbox.c +1 -1
index 731cb43b570e..54f434733b56 100644
@@ -243,7 +243,7 @@ static bool cxl_payload_from_user_allowed(u16 opcode, void *payload_in)
 	case CXL_MBOX_OP_SET_PARTITION_INFO: {
 		struct cxl_mbox_set_partition_info *pi = payload_in;
 
-		if (pi->flags && CXL_SET_PARTITION_IMMEDIATE_FLAG)
+		if (pi->flags & CXL_SET_PARTITION_IMMEDIATE_FLAG)
 			return false;
 		break;
 	}
Signature · 1 line
2.35.1