]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vmcore: clean up by removing unnecessary variable
authorHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Wed, 20 Mar 2013 04:08:33 +0000 (15:08 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Mar 2013 04:23:27 +0000 (15:23 +1100)
The variable j has int type but it's compared with u64 type.

Also, the purpose of the variable j is exactly what the variable real_sz
is used for now.  Replace the variable j by the variable real_sz and
remove the variable j.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/vmcore.c

index 163281e1d1b0e56cdb8c9d9204ec687325837232..94743d2f9f8be1271330aad16a7e7279a39cbab5 100644 (file)
@@ -261,7 +261,6 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz,
        ehdr_ptr = (Elf64_Ehdr *)elfptr;
        phdr_ptr = (Elf64_Phdr*)(elfptr + ehdr_ptr->e_phoff);
        for (i = 0; i < ehdr_ptr->e_phnum; i++, phdr_ptr++) {
-               int j;
                void *notes_section;
                struct vmcore *new;
                u64 offset, max_sz, sz, real_sz = 0;
@@ -279,7 +278,7 @@ static int __init merge_note_headers_elf64(char *elfptr, size_t *elfsz,
                        return rc;
                }
                nhdr_ptr = notes_section;
-               for (j = 0; j < max_sz; j += sz) {
+               while (real_sz < max_sz) {
                        if (nhdr_ptr->n_namesz == 0)
                                break;
                        sz = sizeof(Elf64_Nhdr) +
@@ -342,7 +341,6 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz,
        ehdr_ptr = (Elf32_Ehdr *)elfptr;
        phdr_ptr = (Elf32_Phdr*)(elfptr + ehdr_ptr->e_phoff);
        for (i = 0; i < ehdr_ptr->e_phnum; i++, phdr_ptr++) {
-               int j;
                void *notes_section;
                struct vmcore *new;
                u64 offset, max_sz, sz, real_sz = 0;
@@ -360,7 +358,7 @@ static int __init merge_note_headers_elf32(char *elfptr, size_t *elfsz,
                        return rc;
                }
                nhdr_ptr = notes_section;
-               for (j = 0; j < max_sz; j += sz) {
+               while (real_sz < max_sz) {
                        if (nhdr_ptr->n_namesz == 0)
                                break;
                        sz = sizeof(Elf32_Nhdr) +