* [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment
@ 2014-11-07 11:23 Alban Bedel
2014-11-07 11:23 ` [PATCH 2/2] MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment Alban Bedel
2014-11-07 12:43 ` [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Sergei Shtylyov
0 siblings, 2 replies; 4+ messages in thread
From: Alban Bedel @ 2014-11-07 11:23 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mips, Ralf Baechle, Alban Bedel
When reading u-boot's key=value pairs it should skip the '=' and not
use the next argument.
Signed-off-by: Alban Bedel <albeu@free.fr>
---
arch/mips/fw/lib/cmdline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
index ffd0345..cc5d168 100644
--- a/arch/mips/fw/lib/cmdline.c
+++ b/arch/mips/fw/lib/cmdline.c
@@ -68,7 +68,7 @@ char *fw_getenv(char *envname)
result = fw_envp(index + 1);
break;
} else if (fw_envp(index)[i] == '=') {
- result = (fw_envp(index + 1) + i);
+ result = (fw_envp(index) + i + 1);
break;
}
}
--
2.0.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment
2014-11-07 11:23 [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Alban Bedel
@ 2014-11-07 11:23 ` Alban Bedel
2014-11-07 12:43 ` [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Sergei Shtylyov
1 sibling, 0 replies; 4+ messages in thread
From: Alban Bedel @ 2014-11-07 11:23 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mips, Ralf Baechle, Alban Bedel
Fix some value corruptions with values that can't be represented in a
signed long.
Signed-off-by: Alban Bedel <albeu@free.fr>
---
arch/mips/fw/lib/cmdline.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
index cc5d168..e680624 100644
--- a/arch/mips/fw/lib/cmdline.c
+++ b/arch/mips/fw/lib/cmdline.c
@@ -88,13 +88,13 @@ unsigned long fw_getenvl(char *envname)
{
unsigned long envl = 0UL;
char *str;
- long val;
int tmp;
str = fw_getenv(envname);
if (str) {
- tmp = kstrtol(str, 0, &val);
- envl = (unsigned long)val;
+ tmp = kstrtoul(str, 0, &envl);
+ if (tmp)
+ envl = 0;
}
return envl;
--
2.0.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment
2014-11-07 11:23 [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Alban Bedel
2014-11-07 11:23 ` [PATCH 2/2] MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment Alban Bedel
@ 2014-11-07 12:43 ` Sergei Shtylyov
2014-11-08 11:36 ` Alban
1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2014-11-07 12:43 UTC (permalink / raw)
To: Alban Bedel, linux-kernel; +Cc: linux-mips, Ralf Baechle
Hello.
On 11/7/2014 2:23 PM, Alban Bedel wrote:
> When reading u-boot's key=value pairs it should skip the '=' and not
> use the next argument.
> Signed-off-by: Alban Bedel <albeu@free.fr>
> ---
> arch/mips/fw/lib/cmdline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
> index ffd0345..cc5d168 100644
> --- a/arch/mips/fw/lib/cmdline.c
> +++ b/arch/mips/fw/lib/cmdline.c
> @@ -68,7 +68,7 @@ char *fw_getenv(char *envname)
> result = fw_envp(index + 1);
> break;
> } else if (fw_envp(index)[i] == '=') {
> - result = (fw_envp(index + 1) + i);
> + result = (fw_envp(index) + i + 1);
Perhaps it's time to drop the useless outer parens?
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment
2014-11-07 12:43 ` [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Sergei Shtylyov
@ 2014-11-08 11:36 ` Alban
0 siblings, 0 replies; 4+ messages in thread
From: Alban @ 2014-11-08 11:36 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Aban Bedel, linux-kernel, linux-mips, Ralf Baechle
On Fri, 07 Nov 2014 15:43:10 +0300
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 11/7/2014 2:23 PM, Alban Bedel wrote:
>
> > When reading u-boot's key=value pairs it should skip the '=' and not
> > use the next argument.
>
> > Signed-off-by: Alban Bedel <albeu@free.fr>
> > ---
> > arch/mips/fw/lib/cmdline.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> > diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
> > index ffd0345..cc5d168 100644
> > --- a/arch/mips/fw/lib/cmdline.c
> > +++ b/arch/mips/fw/lib/cmdline.c
> > @@ -68,7 +68,7 @@ char *fw_getenv(char *envname)
> > result = fw_envp(index +
> > 1); break;
> > } else if (fw_envp(index)[i] ==
> > '=') {
> > - result = (fw_envp(index +
> > 1) + i);
> > + result = (fw_envp(index) +
> > i + 1);
>
> Perhaps it's time to drop the useless outer parens?
I agree, I'm sending a new serie.
Alban
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-08 11:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 11:23 [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Alban Bedel
2014-11-07 11:23 ` [PATCH 2/2] MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment Alban Bedel
2014-11-07 12:43 ` [PATCH 1/2] MIPS: FW: Fix parsing u-boot environment Sergei Shtylyov
2014-11-08 11:36 ` Alban
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox