autofs4: redundant null check on kfree()
Subsystems (2)
PATCH 1/2 autofs4: redundant null check on kfree()
From: JieJing.Zhang <[email protected]>
Signed-off-by JieJing.Zhang <[email protected]>
--- fs/autofs4/inode.c | 6 ++---- fs/autofs4/waitq.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)
fs/autofs4/inode.c +2 -4
@@ -24,10 +24,8 @@static void ino_lnkfree (struct autofs_info *ino) { -if (ino->u.symlink) { -kfree (ino->u.symlink); - ino->u.symlink =NULL ; - } +kfree (ino->u.symlink); + ino->u.symlink =NULL ; } struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
fs/autofs4/waitq.c +2 -4
@@ -42,10 +42,8 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)while (wq) { nwq = wq->next; wq->status = -ENOENT ;/* Magic is gone - report failure */ -if (wq->name.name) { -kfree (wq->name.name); - wq->name.name =NULL ; - } +kfree (wq->name.name); + wq->name.name =NULL ; wq->wait_ctr--;wake_up_interruptible (&wq->queue); wq = nwq;
Signature · 1 line
1.7.0.4
PATCH 2/2 Btrfs: handle memory alloc failure in btrfs_file_aio_write()
From: JieJing.Zhang <[email protected]>
Signed-off-by JieJing.Zhang <[email protected]>
--- fs/btrfs/file.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
fs/btrfs/file.c +4 -0
@@ -926,6 +926,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,PAGE_CACHE_SIZE ,PAGE_CACHE_SIZE / (sizeof(struct page *))); pages =kmalloc (nrptrs *sizeof (struct page *),GFP_KERNEL ); +if (unlikely (!pages)) { + ret = -ENOMEM ; + goto out; + }/* generic_write_checks can change our pos */ start_pos = pos;
Signature · 1 line
1.7.0.4