diff mbox series

cxl/mbox: fix logical vs bitwise typo

Message ID YmpgkbbQ1Yxu36uO@kili
State Accepted
Commit 35e01667c84b1e16060020c3a13099447e61c822
Headers show
Series cxl/mbox: fix logical vs bitwise typo | expand

Commit Message

Dan Carpenter April 28, 2022, 9:38 a.m. UTC
This should be bitwise & instead of &&.

Fixes: 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams April 28, 2022, 5:01 p.m. UTC | #1
On Thu, Apr 28, 2022 at 2:39 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This should be bitwise & instead of &&.
>
> Fixes: 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan, good find.
Alison Schofield April 29, 2022, 2:37 a.m. UTC | #2
On Thu, Apr 28, 2022 at 02:38:25AM -0700, Dan Carpenter wrote:
> This should be bitwise & instead of &&.

Thanks Dan. How'd you find this?

> 
> Fixes: 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/cxl/core/mbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 731cb43b570e..54f434733b56 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -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;
>  	}
> -- 
> 2.35.1
>
Dan Carpenter May 6, 2022, 1:50 p.m. UTC | #3
On Thu, Apr 28, 2022 at 07:37:00PM -0700, Alison Schofield wrote:
> On Thu, Apr 28, 2022 at 02:38:25AM -0700, Dan Carpenter wrote:
> > 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

> > 
> > Fixes: 6179045ccc0c ("cxl/mbox: Block immediate mode in SET_PARTITION_INFO command")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/cxl/core/mbox.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> > index 731cb43b570e..54f434733b56 100644
> > --- a/drivers/cxl/core/mbox.c
> > +++ b/drivers/cxl/core/mbox.c
> > @@ -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;
> >  	}
> > -- 
> > 2.35.1
> >
diff mbox series

Patch

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 731cb43b570e..54f434733b56 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -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;
 	}