ipc,msg: make msgctl_nolock lockless
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / vmalloc.c
index 318c500..13a5495 100644 (file)
@@ -388,12 +388,12 @@ nocache:
                addr = ALIGN(first->va_end, align);
                if (addr < vstart)
                        goto nocache;
-               if (addr + size - 1 < addr)
+               if (addr + size < addr)
                        goto overflow;
 
        } else {
                addr = ALIGN(vstart, align);
-               if (addr + size - 1 < addr)
+               if (addr + size < addr)
                        goto overflow;
 
                n = vmap_area_root.rb_node;
@@ -420,7 +420,7 @@ nocache:
                if (addr + cached_hole_size < first->va_start)
                        cached_hole_size = first->va_start - addr;
                addr = ALIGN(first->va_end, align);
-               if (addr + size - 1 < addr)
+               if (addr + size < addr)
                        goto overflow;
 
                if (list_is_last(&first->list, &vmap_area_list))
@@ -1477,7 +1477,6 @@ static void __vunmap(const void *addr, int deallocate_pages)
  *     conventions for vfree() arch-depenedent would be a really bad idea)
  *
  *     NOTE: assumes that the object at *addr has a size >= sizeof(llist_node)
- *     
  */
 void vfree(const void *addr)
 {
@@ -1489,8 +1488,8 @@ void vfree(const void *addr)
                return;
        if (unlikely(in_interrupt())) {
                struct vfree_deferred *p = &__get_cpu_var(vfree_deferred);
-               llist_add((struct llist_node *)addr, &p->list);
-               schedule_work(&p->wq);
+               if (llist_add((struct llist_node *)addr, &p->list))
+                       schedule_work(&p->wq);
        } else
                __vunmap(addr, 1);
 }