diff mbox series

mm/zswap: fix variable 'entry' is uninitialized when used

Message ID 1611223030-58346-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series mm/zswap: fix variable 'entry' is uninitialized when used | expand

Commit Message

Tian Tao Jan. 21, 2021, 9:57 a.m. UTC
the entry has not been initialized when it is used, so allocate PAGE_SIZE

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Souptick Joarder Jan. 28, 2021, 4:09 a.m. UTC | #1
On Thu, Jan 21, 2021 at 3:27 PM Tian Tao <tiantao6@hisilicon.com> wrote:
>
> the entry has not been initialized when it is used, so allocate PAGE_SIZE

Can you please add the original error msg in change logs ?

>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
>  mm/zswap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 6e0bb61..4b7b6ad 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -944,7 +944,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
>
>         if (!zpool_can_sleep_mapped(pool)) {
>
> -               tmp = kmalloc(entry->length, GFP_ATOMIC);
> +               tmp = kmalloc(PAGE_SIZE, GFP_ATOMIC);
>                 if (!tmp)
>                         return -ENOMEM;
>         }
> --
> 2.7.4
>
>
Vitaly Wool Jan. 28, 2021, 8:30 a.m. UTC | #2
On Thu, Jan 28, 2021, 5:09 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:

> On Thu, Jan 21, 2021 at 3:27 PM Tian Tao <tiantao6@hisilicon.com> wrote:
> >
> > the entry has not been initialized when it is used, so allocate PAGE_SIZE
>
> Can you please add the original error msg in change logs ?
>

I second that. Another option would be to come up with an update of the
original patch which would incorporate all the fixes. I believe it should
be possible, since the initial patch has not been merged into Linus tree.

Best regards,
   Vitaly


> >
> > Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> > Reported-by: kernel test robot <lkp@intel.com>
> > ---
> >  mm/zswap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/zswap.c b/mm/zswap.c
> > index 6e0bb61..4b7b6ad 100644
> > --- a/mm/zswap.c
> > +++ b/mm/zswap.c
> > @@ -944,7 +944,7 @@ static int zswap_writeback_entry(struct zpool *pool,
> unsigned long handle)
> >
> >         if (!zpool_can_sleep_mapped(pool)) {
> >
> > -               tmp = kmalloc(entry->length, GFP_ATOMIC);
> > +               tmp = kmalloc(PAGE_SIZE, GFP_ATOMIC);
> >                 if (!tmp)
> >                         return -ENOMEM;
> >         }
> > --
> > 2.7.4
> >
> >
>
Song Bao Hua (Barry Song) Jan. 28, 2021, 8:36 a.m. UTC | #3
>
> the entry has not been initialized when it is used, so allocate PAGE_SIZE

>> Can you please add the original error msg in change logs ?

> I second that. Another option would be to come up with an update of the original patch which would incorporate all the 
> fixes. I believe it should be possible, since the initial patch has not been merged into Linus tree.

+1 for 
"an update of the original patch which would incorporate all the fixes."
It seems Andrew usually folded-merge patches before sending to Linus?

> Best regards,
>   Vitaly

Thanks
Barry
diff mbox series

Patch

diff --git a/mm/zswap.c b/mm/zswap.c
index 6e0bb61..4b7b6ad 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -944,7 +944,7 @@  static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
 
 	if (!zpool_can_sleep_mapped(pool)) {
 
-		tmp = kmalloc(entry->length, GFP_ATOMIC);
+		tmp = kmalloc(PAGE_SIZE, GFP_ATOMIC);
 		if (!tmp)
 			return -ENOMEM;
 	}