From dbc9c3894b552342ccb114068ff82c54972a044c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 23 May 2013 10:36:47 +1000 Subject: [PATCH] shm-fix-null-pointer-deref-when-userspace-specifies-invalid-hugepage-size-fix eliminate ugly 80-col tricks Cc: Dave Jones Cc: Davidlohr Bueso Cc: Li Zefan Cc: Li Zefan Cc: Naoya Horiguchi Cc: Rik van Riel Signed-off-by: Andrew Morton --- ipc/shm.c | 4 ++-- mm/mmap.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ipc/shm.c b/ipc/shm.c index 7e199fa1960f..85dc001634b1 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -491,10 +491,10 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) sprintf (name, "SYSV%08x", key); if (shmflg & SHM_HUGETLB) { - struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT) - & SHM_HUGE_MASK); + struct hstate *hs; size_t hugesize; + hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK); if (!hs) { error = -EINVAL; goto no_file; diff --git a/mm/mmap.c b/mm/mmap.c index f681e1842fad..ec75bb0681f9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1367,9 +1367,9 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, len = ALIGN(len, huge_page_size(hstate_file(file))); } else if (flags & MAP_HUGETLB) { struct user_struct *user = NULL; - struct hstate *hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & - SHM_HUGE_MASK); + struct hstate *hs; + hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & SHM_HUGE_MASK); if (!hs) return -EINVAL; -- 2.39.5