]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - ipc/shm.c
Finally eradicate CONFIG_HOTPLUG
[karo-tx-linux.git] / ipc / shm.c
index 34af1fe34701afd06678ea83a47649b1947a4a65..7e199fa1960f86087c557bcc39b08d304c2b8f7b 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -493,7 +493,13 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
        if (shmflg & SHM_HUGETLB) {
                struct hstate *hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT)
                                                & SHM_HUGE_MASK);
-               size_t hugesize = ALIGN(size, huge_page_size(hs));
+               size_t hugesize;
+
+               if (!hs) {
+                       error = -EINVAL;
+                       goto no_file;
+               }
+               hugesize = ALIGN(size, huge_page_size(hs));
 
                /* hugetlb_file_setup applies strict accounting */
                if (shmflg & SHM_NORESERVE)