On Wed, Oct 24, 2012 at 01:46:39AM +0400, Cyrill Gorcunov wrote:
> 
> > Also...  what happens if there's an unrecognised bit set in `flags'? 
> > Memory corruption or code skew could cause this.  We emit a couple of
> > NULs into the procfs output, which I guess is an OK response to such a
> > condition.
> 
> That's indeed will produce some nil character on the screen. I guess we
> need some designited init here, say
> 
>       [0 ... (BITS_PER_LONG-1)] = { {'-', '-'} },
>       ...
>       [ilog2(VM_READ)]        = { {'r', 'd'} },
>       ...
>       and so on, i'll update on top
> 

Andrew, could you please fold it on top of your
procfs-add-vmflags-field-in-smaps-output-v3-fix ?

(If this is inconvenient -- just give me a word and I'll
 squash everything in one new patch instead).
---
From: Cyrill Gorcunov <[email protected]>
Subject: procfs-add-vmflags-field-in-smaps-output-v3-fix-on-top

Use designated init to assign "??" mnemonic on unknown flags.

Signed-off-by: Cyrill Gorcunov <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Andrew Morton <[email protected]>
---
 fs/proc/task_mmu.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -488,6 +488,11 @@ static void show_smap_vma_flags(struct s
        static const struct {
                const char l[2];
        } mnemonics[BITS_PER_LONG] = {
+               /*
+                * In case if we meet a flag we don't know about.
+                */
+               [0 ... (BITS_PER_LONG-1)] = { {'?', '?'} },
+
                [ilog2(VM_READ)]        = { {'r', 'd'} },
                [ilog2(VM_WRITE)]       = { {'w', 'r'} },
                [ilog2(VM_EXEC)]        = { {'e', 'x'} },
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to