LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] typec: tcpm: Fix incorrect 'and' operator
@ 2018-04-30 13:23 Gustavo A. R. Silva
  2018-04-30 14:44 ` Adam Thomson
  2018-05-02 14:07 ` Heikki Krogerus
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2018-04-30 13:23 UTC (permalink / raw)
  To: Adam Thomson, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, kernel-janitors, Gustavo A. R. Silva

Currently, logical and is being used instead of *bitwise* and.

Fix this by using a proper bitwise and operator.

Addresses-Coverity-ID: 1468455 ("Logical vs. bitwise operator")
Fixes: 64f7c494a3c0 ("typec: tcpm: Add support for sink PPS related messages")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 drivers/usb/typec/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 1ee259b..7ee417a 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -1772,7 +1772,7 @@ static void tcpm_pd_ext_msg_request(struct tcpm_port *port,
 	enum pd_ext_msg_type type = pd_header_type_le(msg->header);
 	unsigned int data_size = pd_ext_header_data_size_le(msg->ext_msg.header);
 
-	if (!(msg->ext_msg.header && PD_EXT_HDR_CHUNKED)) {
+	if (!(msg->ext_msg.header & PD_EXT_HDR_CHUNKED)) {
 		tcpm_log(port, "Unchunked extended messages unsupported");
 		return;
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] typec: tcpm: Fix incorrect 'and' operator
  2018-04-30 13:23 [PATCH] typec: tcpm: Fix incorrect 'and' operator Gustavo A. R. Silva
@ 2018-04-30 14:44 ` Adam Thomson
  2018-05-02 14:07 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2018-04-30 14:44 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Adam Thomson, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, kernel-janitors

On 30 April 2018 14:23, Gustavo A. R. Silva wrote:

> Currently, logical and is being used instead of *bitwise* and.
> 
> Fix this by using a proper bitwise and operator.
> 
> Addresses-Coverity-ID: 1468455 ("Logical vs. bitwise operator")
> Fixes: 64f7c494a3c0 ("typec: tcpm: Add support for sink PPS related
> messages")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---

Good spot. :(

Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

>  drivers/usb/typec/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 1ee259b..7ee417a 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -1772,7 +1772,7 @@ static void tcpm_pd_ext_msg_request(struct tcpm_port
> *port,
>  	enum pd_ext_msg_type type = pd_header_type_le(msg->header);
>  	unsigned int data_size = pd_ext_header_data_size_le(msg-
> >ext_msg.header);
> 
> -	if (!(msg->ext_msg.header && PD_EXT_HDR_CHUNKED)) {
> +	if (!(msg->ext_msg.header & PD_EXT_HDR_CHUNKED)) {
>  		tcpm_log(port, "Unchunked extended messages unsupported");
>  		return;
>  	}
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] typec: tcpm: Fix incorrect 'and' operator
  2018-04-30 13:23 [PATCH] typec: tcpm: Fix incorrect 'and' operator Gustavo A. R. Silva
  2018-04-30 14:44 ` Adam Thomson
@ 2018-05-02 14:07 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2018-05-02 14:07 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Adam Thomson, Greg Kroah-Hartman, linux-usb, linux-kernel,
	kernel-janitors

On Mon, Apr 30, 2018 at 08:23:06AM -0500, Gustavo A. R. Silva wrote:
> Currently, logical and is being used instead of *bitwise* and.
> 
> Fix this by using a proper bitwise and operator.
> 
> Addresses-Coverity-ID: 1468455 ("Logical vs. bitwise operator")
> Fixes: 64f7c494a3c0 ("typec: tcpm: Add support for sink PPS related
> messages")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 1ee259b..7ee417a 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -1772,7 +1772,7 @@ static void tcpm_pd_ext_msg_request(struct tcpm_port *port,
>  	enum pd_ext_msg_type type = pd_header_type_le(msg->header);
>  	unsigned int data_size = pd_ext_header_data_size_le(msg->ext_msg.header);
>  
> -	if (!(msg->ext_msg.header && PD_EXT_HDR_CHUNKED)) {
> +	if (!(msg->ext_msg.header & PD_EXT_HDR_CHUNKED)) {
>  		tcpm_log(port, "Unchunked extended messages unsupported");
>  		return;
>  	}

Thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-02 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 13:23 [PATCH] typec: tcpm: Fix incorrect 'and' operator Gustavo A. R. Silva
2018-04-30 14:44 ` Adam Thomson
2018-05-02 14:07 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).