Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655212 > unrolled thread

Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument.

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-06-01 17:00 +0200
Last post2017-06-01 17:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in  argument. Dan Carpenter <dan.carpenter@oracle.com> - 2017-06-01 17:00 +0200
    Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in  argument. Guenter Roeck <linux@roeck-us.net> - 2017-06-01 17:20 +0200

#1655212 — Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument.

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-06-01 17:00 +0200
SubjectRe: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument.
Message-ID<tNzJT-3Qo-1@gated-at.bofh.it>
On Thu, Jun 01, 2017 at 07:21:00AM +0000, ? ? wrote:
> From: Pan Li <incarnation.p.lee@outlook.com>
> 
>     Convert type le16 to cpu of argument 1 in function pd_header_cnt.
> 
> Signed-off-by: Pan Li <incarnation.p.lee@outlook.com>
> ---
>  drivers/staging/typec/tcpci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> index df72d8b..405c9cc 100644
> --- a/drivers/staging/typec/tcpci.c
> +++ b/drivers/staging/typec/tcpci.c
> @@ -287,7 +287,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc,
>  	unsigned int reg, cnt, header;
>  	int ret;
>  
> -	cnt = msg ? pd_header_cnt(msg->header) * 4 : 0;
> +	cnt = msg ? pd_header_cnt(le16_to_cpu(msg->header)) * 4 : 0;

I guess this one is probably correct...

regards,
dan carpenter

[toc] | [next] | [standalone]


#1655242

FromGuenter Roeck <linux@roeck-us.net>
Date2017-06-01 17:20 +0200
Message-ID<tNA3g-4do-19@gated-at.bofh.it>
In reply to#1655212
On Thu, Jun 01, 2017 at 05:57:14PM +0300, Dan Carpenter wrote:
> On Thu, Jun 01, 2017 at 07:21:00AM +0000, ? ? wrote:
> > From: Pan Li <incarnation.p.lee@outlook.com>
> > 
> >     Convert type le16 to cpu of argument 1 in function pd_header_cnt.
> > 
> > Signed-off-by: Pan Li <incarnation.p.lee@outlook.com>
> > ---
> >  drivers/staging/typec/tcpci.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> > index df72d8b..405c9cc 100644
> > --- a/drivers/staging/typec/tcpci.c
> > +++ b/drivers/staging/typec/tcpci.c
> > @@ -287,7 +287,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc,
> >  	unsigned int reg, cnt, header;
> >  	int ret;
> >  
> > -	cnt = msg ? pd_header_cnt(msg->header) * 4 : 0;
> > +	cnt = msg ? pd_header_cnt(le16_to_cpu(msg->header)) * 4 : 0;
> 
> I guess this one is probably correct...
> 
Yes. Overall though the series only touches the surface; the driver as-is is
just not endianness clean. Someone will have to go through it and fix all
problems. For example, tcpci_read16() is flawed since it reads 16 bits into
a unrestricted 32 bit variable pointer. This needs some active work and can
not rely on code analysis to find and fix the all flaws. Something to add
to TODO.

Side note: The subject lines in this series are all messed up.

Thanks,
Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web