warning: do-while statement is not a compound statement
Signed-off-by: Thiago Farina <[email protected]>
---
fs/binfmt_elf.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index edd90c4..75d6468 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1404,9 +1404,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
{
elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
int i = 0;
- do
+ do {
i += 2;
- while (auxv[i - 2] != AT_NULL);
+ } while (auxv[i - 2] != AT_NULL);
fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
}
--
1.6.6.243.gff6d2
Thiago Farina wrote:
> warning: do-while statement is not a compound statement
>
> Signed-off-by: Thiago Farina <[email protected]>
Acked-by: WANG Cong <[email protected]>
> ---
> fs/binfmt_elf.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index edd90c4..75d6468 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1404,9 +1404,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
> {
> elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
> int i = 0;
> - do
> + do {
> i += 2;
> - while (auxv[i - 2] != AT_NULL);
> + } while (auxv[i - 2] != AT_NULL);
> fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
> }
>
On Wed, 20 Jan 2010 23:03:53 -0500
Thiago Farina <[email protected]> wrote:
> warning: do-while statement is not a compound statement
>
> Signed-off-by: Thiago Farina <[email protected]>
> ---
> fs/binfmt_elf.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index edd90c4..75d6468 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1404,9 +1404,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
> {
> elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
> int i = 0;
> - do
> + do {
> i += 2;
> - while (auxv[i - 2] != AT_NULL);
> + } while (auxv[i - 2] != AT_NULL);
> fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
> }
hmpf. Which tool emitted that warning? sparse?
It is somewhat unconventional coding style and it'd be good if
checkpatch were to warn so that we don't _add_ such things to the tree.
But IMO it's such a minor thing that once it _is_ in the tree, it's not
really worth the patch noise to go and fix it up.
Hi Andrew,
On Tue, Jan 26, 2010 at 10:06 PM, Andrew Morton
<[email protected]> wrote:
> On Wed, 20 Jan 2010 23:03:53 -0500
> Thiago Farina <[email protected]> wrote:
>
>> warning: do-while statement is not a compound statement
>>
>> Signed-off-by: Thiago Farina <[email protected]>
>> ---
>> fs/binfmt_elf.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
>> index edd90c4..75d6468 100644
>> --- a/fs/binfmt_elf.c
>> +++ b/fs/binfmt_elf.c
>> @@ -1404,9 +1404,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
>> {
>> elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
>> int i = 0;
>> - do
>> + do {
>> i += 2;
>> - while (auxv[i - 2] != AT_NULL);
>> + } while (auxv[i - 2] != AT_NULL);
>> fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
>> }
>
> hmpf. Which tool emitted that warning? sparse?
>
Yes, it is a sparse warning.
> It is somewhat unconventional coding style and it'd be good if
> checkpatch were to warn so that we don't _add_ such things to the tree.
>
> But IMO it's such a minor thing that once it _is_ in the tree, it's not
> really worth the patch noise to go and fix it up.
Yeah, much noise for a small thing. I will not fix more warnings like
this in future.
-Thiago
On Tue, 26 Jan 2010 23:44:29 -0200 Thiago Farina <[email protected]> wrote:
> > It is somewhat unconventional coding style and it'd be good if
> > checkpatch were to warn so that we don't _add_ such things to the tree.
> >
> > But IMO it's such a minor thing that once it _is_ in the tree, it's not
> > really worth the patch noise to go and fix it up.
>
> Yeah, much noise for a small thing. I will not fix more warnings like
> this in future.
I'd be OK with fixing things like this as part of a larger
"fs/binfmt_elf.c: coding-style fixes" or "fs/*elf.c: ...", etc. One
big hit. It's the little dribble of one-line fixes which I'd prefer to
avoid.