Commit 26c8f0d601f5d4c0d9f4bc8c5151539aae5dc26a
Committed by
Steve French
1 parent
83e3bc23ef
Exists in
master
and in
16 other branches
cifs: use a flexarray in cifs_writedata
The cifs_writedata code uses a single element trailing array, which just adds unneeded complexity. Use a flexarray instead. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Showing 2 changed files with 2 additions and 8 deletions Side-by-side Diff
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
... | ... | @@ -1962,15 +1962,9 @@ |
1962 | 1962 | { |
1963 | 1963 | struct cifs_writedata *wdata; |
1964 | 1964 | |
1965 | - /* this would overflow */ | |
1966 | - if (nr_pages == 0) { | |
1967 | - cifs_dbg(VFS, "%s: called with nr_pages == 0!\n", __func__); | |
1968 | - return NULL; | |
1969 | - } | |
1970 | - | |
1971 | 1965 | /* writedata + number of page pointers */ |
1972 | 1966 | wdata = kzalloc(sizeof(*wdata) + |
1973 | - sizeof(struct page *) * (nr_pages - 1), GFP_NOFS); | |
1967 | + sizeof(struct page *) * nr_pages, GFP_NOFS); | |
1974 | 1968 | if (wdata != NULL) { |
1975 | 1969 | kref_init(&wdata->refcount); |
1976 | 1970 | INIT_LIST_HEAD(&wdata->list); |