[PATCH 1/1] mm/slab: remove duplicate check in create_cache()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The WARN_ON() check in static function create_cache() is done by its only
parent kmem_cache_create_usercopy() before calling it.
	if (...
	    WARN_ON(size < usersize || size - usersize < useroffset))
		usersize = useroffset = 0;
	...
	s = create_cache(..., size, ..., useroffset, usersize, ...);

Therefore, the WARN_ON() check in create_cache() can be safely removed.

Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
---
 mm/slab_common.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 40b582a014b8f2f..3069c9095523484 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -210,9 +210,6 @@ static struct kmem_cache *create_cache(const char *name,
 	struct kmem_cache *s;
 	int err;
 
-	if (WARN_ON(useroffset + usersize > object_size))
-		useroffset = usersize = 0;
-
 	err = -ENOMEM;
 	s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL);
 	if (!s)
-- 
2.34.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux