linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used
@ 2021-01-21  9:57 Tian Tao
  2021-01-28  4:09 ` Souptick Joarder
  0 siblings, 1 reply; 4+ messages in thread
From: Tian Tao @ 2021-01-21  9:57 UTC (permalink / raw)
  To: vitaly.wool, sjenning, song.bao.hua, ddstreet, akpm; +Cc: linux-mm

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(-)

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used
  2021-01-21  9:57 [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used Tian Tao
@ 2021-01-28  4:09 ` Souptick Joarder
  2021-01-28  8:30   ` Vitaly Wool
  0 siblings, 1 reply; 4+ messages in thread
From: Souptick Joarder @ 2021-01-28  4:09 UTC (permalink / raw)
  To: Tian Tao
  Cc: vitaly.wool, Seth Jennings, Barry Song, Dan Streetman,
	Andrew Morton, Linux-MM

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
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used
  2021-01-28  4:09 ` Souptick Joarder
@ 2021-01-28  8:30   ` Vitaly Wool
  2021-01-28  8:36     ` Song Bao Hua (Barry Song)
  0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Wool @ 2021-01-28  8:30 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: Tian Tao, Seth Jennings, Barry Song, Dan Streetman,
	Andrew Morton, Linux-MM

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

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
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 2297 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used
  2021-01-28  8:30   ` Vitaly Wool
@ 2021-01-28  8:36     ` Song Bao Hua (Barry Song)
  0 siblings, 0 replies; 4+ messages in thread
From: Song Bao Hua (Barry Song) @ 2021-01-28  8:36 UTC (permalink / raw)
  To: Vitaly Wool, Souptick Joarder
  Cc: tiantao (H), Seth Jennings, Dan Streetman, Andrew Morton, Linux-MM

>
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-28  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21  9:57 [PATCH] mm/zswap: fix variable 'entry' is uninitialized when used Tian Tao
2021-01-28  4:09 ` Souptick Joarder
2021-01-28  8:30   ` Vitaly Wool
2021-01-28  8:36     ` Song Bao Hua (Barry Song)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).