@@ -863,8 +863,10 @@ static int ubifs_bulk_read(struct page *page)
bu = &c->bu;
else {
bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN);
- if (!bu)
+ if (!bu) {
+ err = -ENOMEM;
goto out_unlock;
+ }
bu->buf = NULL;
allocated = 1;
@@ -887,8 +889,11 @@ out_unlock:
static int ubifs_readpage(struct file *file, struct page *page)
{
- if (ubifs_bulk_read(page))
- return 0;
+ int err = 0;
+
+ err = ubifs_bulk_read(page);
+ if (err)
+ return err;
do_readpage(page);
unlock_page(page);
return 0;
Currently, ubifs_readpage only returns 0 even if ubifs_bulk_read() fails. Therefore propagating error to the above functions which have called ubifs_readpage. Another check that is missing is ENOMEM for kmalloc in ubifs_bulk_read. Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com> --- fs/ubifs/file.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)