Commit 4030b278 authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French
Browse files

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: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 9cca7516
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;