* [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-11 20:29 ` Anirudh Rayabharam
0 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-11 20:29 UTC (permalink / raw)
To: lee.jones, kuba, johannes, colin.king, arnd, gregkh
Cc: Anirudh Rayabharam, devel, linux-kernel
Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
function:
wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
wimax/i2400m/fw.c:195:34: left side has type unsigned int
wimax/i2400m/fw.c:195:34: right side has type restricted __le32
wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
---
drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
index b2fd4bd2c5f9..bce651a6b543 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
{
if (i2400m_brh_get_use_checksum(cmd)) {
int i;
- u32 checksum = 0;
+ __le32 checksum = 0;
const u32 *checksum_ptr = (void *) cmd->payload;
- for (i = 0; i < cmd->data_size / 4; i++)
- checksum += cpu_to_le32(*checksum_ptr++);
- checksum += cmd->command + cmd->target_addr + cmd->data_size;
- cmd->block_checksum = cpu_to_le32(checksum);
+ for (i = 0; i < le32_to_cpu(cmd->data_size) / 4; i++)
+ le32_add_cpu(&checksum, *checksum_ptr++);
+
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->command));
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->target_addr));
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->data_size));
+
+ cmd->block_checksum = checksum;
}
}
EXPORT_SYMBOL_GPL(i2400m_bm_cmd_prepare);
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-11 20:29 ` Anirudh Rayabharam
0 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-11 20:29 UTC (permalink / raw)
To: lee.jones, kuba, johannes, colin.king, arnd, gregkh
Cc: devel, Anirudh Rayabharam, linux-kernel
Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
function:
wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
wimax/i2400m/fw.c:195:34: left side has type unsigned int
wimax/i2400m/fw.c:195:34: right side has type restricted __le32
wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
---
drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
index b2fd4bd2c5f9..bce651a6b543 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
{
if (i2400m_brh_get_use_checksum(cmd)) {
int i;
- u32 checksum = 0;
+ __le32 checksum = 0;
const u32 *checksum_ptr = (void *) cmd->payload;
- for (i = 0; i < cmd->data_size / 4; i++)
- checksum += cpu_to_le32(*checksum_ptr++);
- checksum += cmd->command + cmd->target_addr + cmd->data_size;
- cmd->block_checksum = cpu_to_le32(checksum);
+ for (i = 0; i < le32_to_cpu(cmd->data_size) / 4; i++)
+ le32_add_cpu(&checksum, *checksum_ptr++);
+
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->command));
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->target_addr));
+ le32_add_cpu(&checksum, le32_to_cpu(cmd->data_size));
+
+ cmd->block_checksum = checksum;
}
}
EXPORT_SYMBOL_GPL(i2400m_bm_cmd_prepare);
--
2.26.2
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
2021-02-11 20:29 ` Anirudh Rayabharam
@ 2021-02-11 20:35 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-02-11 20:35 UTC (permalink / raw)
To: Anirudh Rayabharam
Cc: lee.jones, kuba, johannes, colin.king, arnd, devel, linux-kernel
On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> function:
>
> wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> wimax/i2400m/fw.c:195:34: left side has type unsigned int
> wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
>
> Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> ---
> drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> index b2fd4bd2c5f9..bce651a6b543 100644
> --- a/drivers/staging/wimax/i2400m/fw.c
> +++ b/drivers/staging/wimax/i2400m/fw.c
> @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> {
> if (i2400m_brh_get_use_checksum(cmd)) {
> int i;
> - u32 checksum = 0;
> + __le32 checksum = 0;
__le32 is only for when the data crosses the kernel/user boundry, just
use le32 in the kernel for stuff like this.
> const u32 *checksum_ptr = (void *) cmd->payload;
Add a blank line here, right?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-11 20:35 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-02-11 20:35 UTC (permalink / raw)
To: Anirudh Rayabharam
Cc: devel, arnd, linux-kernel, colin.king, kuba, johannes, lee.jones
On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> function:
>
> wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> wimax/i2400m/fw.c:195:34: left side has type unsigned int
> wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
>
> Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> ---
> drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> index b2fd4bd2c5f9..bce651a6b543 100644
> --- a/drivers/staging/wimax/i2400m/fw.c
> +++ b/drivers/staging/wimax/i2400m/fw.c
> @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> {
> if (i2400m_brh_get_use_checksum(cmd)) {
> int i;
> - u32 checksum = 0;
> + __le32 checksum = 0;
__le32 is only for when the data crosses the kernel/user boundry, just
use le32 in the kernel for stuff like this.
> const u32 *checksum_ptr = (void *) cmd->payload;
Add a blank line here, right?
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
2021-02-11 20:35 ` Greg KH
@ 2021-02-12 14:30 ` Anirudh Rayabharam
-1 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-12 14:30 UTC (permalink / raw)
To: Greg KH; +Cc: lee.jones, kuba, johannes, colin.king, arnd, devel, linux-kernel
On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > function:
> >
> > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> >
> > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > ---
> > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > 1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > index b2fd4bd2c5f9..bce651a6b543 100644
> > --- a/drivers/staging/wimax/i2400m/fw.c
> > +++ b/drivers/staging/wimax/i2400m/fw.c
> > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > {
> > if (i2400m_brh_get_use_checksum(cmd)) {
> > int i;
> > - u32 checksum = 0;
> > + __le32 checksum = 0;
>
> __le32 is only for when the data crosses the kernel/user boundry, just
> use le32 in the kernel for stuff like this.
>
But that throws a compile error. Also, I don't see le32 defined
in any common header. It is defined in fs/ntfs/types.h but that's not
accessible here.
> > const u32 *checksum_ptr = (void *) cmd->payload;
>
> Add a blank line here, right?
It wasn't there before but makes sense. I'll send v2 with this change.
Thanks!
- Anirudh.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-12 14:30 ` Anirudh Rayabharam
0 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-12 14:30 UTC (permalink / raw)
To: Greg KH; +Cc: devel, arnd, linux-kernel, colin.king, kuba, johannes, lee.jones
On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > function:
> >
> > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> >
> > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > ---
> > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > 1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > index b2fd4bd2c5f9..bce651a6b543 100644
> > --- a/drivers/staging/wimax/i2400m/fw.c
> > +++ b/drivers/staging/wimax/i2400m/fw.c
> > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > {
> > if (i2400m_brh_get_use_checksum(cmd)) {
> > int i;
> > - u32 checksum = 0;
> > + __le32 checksum = 0;
>
> __le32 is only for when the data crosses the kernel/user boundry, just
> use le32 in the kernel for stuff like this.
>
But that throws a compile error. Also, I don't see le32 defined
in any common header. It is defined in fs/ntfs/types.h but that's not
accessible here.
> > const u32 *checksum_ptr = (void *) cmd->payload;
>
> Add a blank line here, right?
It wasn't there before but makes sense. I'll send v2 with this change.
Thanks!
- Anirudh.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
2021-02-12 14:30 ` Anirudh Rayabharam
@ 2021-02-12 14:43 ` Greg KH
-1 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-02-12 14:43 UTC (permalink / raw)
To: Anirudh Rayabharam
Cc: devel, arnd, linux-kernel, colin.king, kuba, johannes, lee.jones
On Fri, Feb 12, 2021 at 08:00:25PM +0530, Anirudh Rayabharam wrote:
> On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> > On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > > function:
> > >
> > > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> > >
> > > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > > ---
> > > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > > 1 file changed, 9 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > > index b2fd4bd2c5f9..bce651a6b543 100644
> > > --- a/drivers/staging/wimax/i2400m/fw.c
> > > +++ b/drivers/staging/wimax/i2400m/fw.c
> > > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > > {
> > > if (i2400m_brh_get_use_checksum(cmd)) {
> > > int i;
> > > - u32 checksum = 0;
> > > + __le32 checksum = 0;
> >
> > __le32 is only for when the data crosses the kernel/user boundry, just
> > use le32 in the kernel for stuff like this.
> >
> But that throws a compile error.
What error?
> Also, I don't see le32 defined
> in any common header. It is defined in fs/ntfs/types.h but that's not
> accessible here.
Ah, my fault, you are right, nevermind.
> > > const u32 *checksum_ptr = (void *) cmd->payload;
> >
> > Add a blank line here, right?
> It wasn't there before but makes sense. I'll send v2 with this change.
Thanks.
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-12 14:43 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2021-02-12 14:43 UTC (permalink / raw)
To: Anirudh Rayabharam
Cc: devel, arnd, linux-kernel, kuba, colin.king, johannes, lee.jones
On Fri, Feb 12, 2021 at 08:00:25PM +0530, Anirudh Rayabharam wrote:
> On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> > On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > > function:
> > >
> > > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> > >
> > > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > > ---
> > > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > > 1 file changed, 9 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > > index b2fd4bd2c5f9..bce651a6b543 100644
> > > --- a/drivers/staging/wimax/i2400m/fw.c
> > > +++ b/drivers/staging/wimax/i2400m/fw.c
> > > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > > {
> > > if (i2400m_brh_get_use_checksum(cmd)) {
> > > int i;
> > > - u32 checksum = 0;
> > > + __le32 checksum = 0;
> >
> > __le32 is only for when the data crosses the kernel/user boundry, just
> > use le32 in the kernel for stuff like this.
> >
> But that throws a compile error.
What error?
> Also, I don't see le32 defined
> in any common header. It is defined in fs/ntfs/types.h but that's not
> accessible here.
Ah, my fault, you are right, nevermind.
> > > const u32 *checksum_ptr = (void *) cmd->payload;
> >
> > Add a blank line here, right?
> It wasn't there before but makes sense. I'll send v2 with this change.
Thanks.
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
2021-02-12 14:43 ` Greg KH
@ 2021-02-12 17:17 ` Anirudh Rayabharam
-1 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-12 17:17 UTC (permalink / raw)
To: Greg KH; +Cc: devel, arnd, linux-kernel, colin.king, kuba, johannes, lee.jones
On Fri, Feb 12, 2021 at 03:43:10PM +0100, Greg KH wrote:
> On Fri, Feb 12, 2021 at 08:00:25PM +0530, Anirudh Rayabharam wrote:
> > On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> > > On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > > > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > > > function:
> > > >
> > > > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > > > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > > > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > > > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> > > >
> > > > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > > > ---
> > > > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > > > 1 file changed, 9 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > > > index b2fd4bd2c5f9..bce651a6b543 100644
> > > > --- a/drivers/staging/wimax/i2400m/fw.c
> > > > +++ b/drivers/staging/wimax/i2400m/fw.c
> > > > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > > > {
> > > > if (i2400m_brh_get_use_checksum(cmd)) {
> > > > int i;
> > > > - u32 checksum = 0;
> > > > + __le32 checksum = 0;
> > >
> > > __le32 is only for when the data crosses the kernel/user boundry, just
> > > use le32 in the kernel for stuff like this.
> > >
> > But that throws a compile error.
>
> What error?
drivers/staging/wimax/i2400m/fw.c:192:3: error: unknown type name
‘le32’; did you mean ‘__le32’?
- Anirudh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse
@ 2021-02-12 17:17 ` Anirudh Rayabharam
0 siblings, 0 replies; 10+ messages in thread
From: Anirudh Rayabharam @ 2021-02-12 17:17 UTC (permalink / raw)
To: Greg KH; +Cc: devel, arnd, linux-kernel, kuba, colin.king, johannes, lee.jones
On Fri, Feb 12, 2021 at 03:43:10PM +0100, Greg KH wrote:
> On Fri, Feb 12, 2021 at 08:00:25PM +0530, Anirudh Rayabharam wrote:
> > On Thu, Feb 11, 2021 at 09:35:27PM +0100, Greg KH wrote:
> > > On Fri, Feb 12, 2021 at 01:59:08AM +0530, Anirudh Rayabharam wrote:
> > > > Fix sparse byte-order warnings in the i2400m_bm_cmd_prepare()
> > > > function:
> > > >
> > > > wimax/i2400m/fw.c:194:36: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:195:34: warning: invalid assignment: +=
> > > > wimax/i2400m/fw.c:195:34: left side has type unsigned int
> > > > wimax/i2400m/fw.c:195:34: right side has type restricted __le32
> > > > wimax/i2400m/fw.c:196:32: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:196:47: warning: restricted __le32 degrades to integer
> > > > wimax/i2400m/fw.c:196:66: warning: restricted __le32 degrades to integer
> > > >
> > > > Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
> > > > ---
> > > > drivers/staging/wimax/i2400m/fw.c | 14 +++++++++-----
> > > > 1 file changed, 9 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/wimax/i2400m/fw.c b/drivers/staging/wimax/i2400m/fw.c
> > > > index b2fd4bd2c5f9..bce651a6b543 100644
> > > > --- a/drivers/staging/wimax/i2400m/fw.c
> > > > +++ b/drivers/staging/wimax/i2400m/fw.c
> > > > @@ -189,12 +189,16 @@ void i2400m_bm_cmd_prepare(struct i2400m_bootrom_header *cmd)
> > > > {
> > > > if (i2400m_brh_get_use_checksum(cmd)) {
> > > > int i;
> > > > - u32 checksum = 0;
> > > > + __le32 checksum = 0;
> > >
> > > __le32 is only for when the data crosses the kernel/user boundry, just
> > > use le32 in the kernel for stuff like this.
> > >
> > But that throws a compile error.
>
> What error?
drivers/staging/wimax/i2400m/fw.c:192:3: error: unknown type name
‘le32’; did you mean ‘__le32’?
- Anirudh
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-02-12 17:18 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 20:29 [PATCH] staging: wimax/i2400m: fix some byte order issues found by sparse Anirudh Rayabharam
2021-02-11 20:29 ` Anirudh Rayabharam
2021-02-11 20:35 ` Greg KH
2021-02-11 20:35 ` Greg KH
2021-02-12 14:30 ` Anirudh Rayabharam
2021-02-12 14:30 ` Anirudh Rayabharam
2021-02-12 14:43 ` Greg KH
2021-02-12 14:43 ` Greg KH
2021-02-12 17:17 ` Anirudh Rayabharam
2021-02-12 17:17 ` Anirudh Rayabharam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.