cifsd: prevent a integer overflow in wm_alloc()

Dan Carpenter pointed out that there there is a possibility of
integer overflow. This patch prevent a integer overflow in wm_alloc().

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Namjae Jeon 2021-04-04 17:52:58 +09:00 committed by Steve French
parent 9cca7516f4
commit 4030b27836

View File

@ -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;