aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/cifsd/buffer_pool.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifsd/buffer_pool.c b/fs/cifsd/buffer_pool.c
index caf22c190634..1ee1feef1bb4 100644
--- a/fs/cifsd/buffer_pool.c
+++ b/fs/cifsd/buffer_pool.c
@@ -42,6 +42,9 @@ static struct wm *wm_alloc(size_t sz, gfp_t flags)
struct wm *wm;
size_t alloc_sz = sz + sizeof(struct wm);
+ if (sz > SIZE_MAX - sizeof(struct wm))
+ return NULL;
+
wm = kvmalloc(alloc_sz, flags);
if (!wm)
return NULL;