All of lore.kernel.org
 help / color / mirror / Atom feed
* [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{, s}
@ 2018-08-23  9:19 Gao Xiang
  2018-08-23 11:02 ` [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s} Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2018-08-23  9:19 UTC (permalink / raw)


As Dan reported in the LKP mailing list:
https://lists.01.org/pipermail/kbuild-all/2018-August/051558.html

New smatch warnings:
drivers/staging/erofs/unzip_vle.c:1359 z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:1322 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?

It needs to cast variable's type to erofs_off_t before left shifting.

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---

Hi Chao,

This patch is based on
`staging: erofs: fix potential overflow in erofs_grab_bio()'
in order to avoid patch conflict when rebasing.

I think it is better to rearrange the commit order in the erofs branch and
it needs to be sent separately in advance to Greg.

Thanks,
Gao Xiang

 drivers/staging/erofs/unzip_vle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
index 6c4c928..22f9a02 100644
--- a/drivers/staging/erofs/unzip_vle.c
+++ b/drivers/staging/erofs/unzip_vle.c
@@ -1314,7 +1314,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
 	LIST_HEAD(pagepool);
 
 #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
-	f.cachedzone_la = page->index << PAGE_SHIFT;
+	f.cachedzone_la = (erofs_off_t)page->index << PAGE_SHIFT;
 #endif
 	err = z_erofs_do_read_page(&f, page, &pagepool);
 	(void)z_erofs_vle_work_iter_end(&f.builder);
@@ -1347,7 +1347,7 @@ static inline int __z_erofs_vle_normalaccess_readpages(
 	LIST_HEAD(pagepool);
 
 #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
-	f.cachedzone_la = lru_to_page(pages)->index << PAGE_SHIFT;
+	f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT;
 #endif
 	for (; nr_pages; --nr_pages) {
 		struct page *page = lru_to_page(pages);
-- 
1.9.1

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

* [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s}
  2018-08-23  9:19 [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{, s} Gao Xiang
@ 2018-08-23 11:02 ` Chao Yu
  2018-08-23 11:16   ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2018-08-23 11:02 UTC (permalink / raw)


On 2018/8/23 17:19, Gao Xiang wrote:
> As Dan reported in the LKP mailing list:
> https://lists.01.org/pipermail/kbuild-all/2018-August/051558.html
> 
> New smatch warnings:
> drivers/staging/erofs/unzip_vle.c:1359 z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?
> 
> Old smatch warnings:
> drivers/staging/erofs/unzip_vle.c:1322 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?
> 
> It needs to cast variable's type to erofs_off_t before left shifting.
> 
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>

Reviewed-by: Chao Yu <yuchao0 at huawei.com>

> ---
> 
> Hi Chao,
> 
> This patch is based on
> `staging: erofs: fix potential overflow in erofs_grab_bio()'
> in order to avoid patch conflict when rebasing.
> 
> I think it is better to rearrange the commit order in the erofs branch and
> it needs to be sent separately in advance to Greg.

Agreed, let me add this into erofs branch later.

Thanks,

> 
> Thanks,
> Gao Xiang
> 
>  drivers/staging/erofs/unzip_vle.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
> index 6c4c928..22f9a02 100644
> --- a/drivers/staging/erofs/unzip_vle.c
> +++ b/drivers/staging/erofs/unzip_vle.c
> @@ -1314,7 +1314,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
>  	LIST_HEAD(pagepool);
>  
>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
> -	f.cachedzone_la = page->index << PAGE_SHIFT;
> +	f.cachedzone_la = (erofs_off_t)page->index << PAGE_SHIFT;
>  #endif
>  	err = z_erofs_do_read_page(&f, page, &pagepool);
>  	(void)z_erofs_vle_work_iter_end(&f.builder);
> @@ -1347,7 +1347,7 @@ static inline int __z_erofs_vle_normalaccess_readpages(
>  	LIST_HEAD(pagepool);
>  
>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
> -	f.cachedzone_la = lru_to_page(pages)->index << PAGE_SHIFT;
> +	f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT;
>  #endif
>  	for (; nr_pages; --nr_pages) {
>  		struct page *page = lru_to_page(pages);
> 

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

* [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s}
  2018-08-23 11:02 ` [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s} Chao Yu
@ 2018-08-23 11:16   ` Gao Xiang
  2018-08-23 11:31     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2018-08-23 11:16 UTC (permalink / raw)


Hi Chao,

On 2018/8/23 19:02, Chao Yu wrote:
> On 2018/8/23 17:19, Gao Xiang wrote:
>> As Dan reported in the LKP mailing list:
>> https://lists.01.org/pipermail/kbuild-all/2018-August/051558.html
>>
>> New smatch warnings:
>> drivers/staging/erofs/unzip_vle.c:1359 z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?
>>
>> Old smatch warnings:
>> drivers/staging/erofs/unzip_vle.c:1322 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?
>>
>> It needs to cast variable's type to erofs_off_t before left shifting.
>>
>> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
>> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
> 
> Reviewed-by: Chao Yu <yuchao0 at huawei.com>
> 
>> ---
>>
>> Hi Chao,
>>
>> This patch is based on
>> `staging: erofs: fix potential overflow in erofs_grab_bio()'
>> in order to avoid patch conflict when rebasing.
>>
>> I think it is better to rearrange the commit order in the erofs branch and
>> it needs to be sent separately in advance to Greg.
> 
> Agreed, let me add this into erofs branch later.
> 
> Thanks,

OK, I will send to Greg appended to the upstream commit
`staging: erofs: fix potential overflow in erofs_grab_bio()`
after you add this into erofs branch and receive the successful daily lkp report.

Thanks,
Gao XIang

> 
>>
>> Thanks,
>> Gao Xiang
>>
>>  drivers/staging/erofs/unzip_vle.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
>> index 6c4c928..22f9a02 100644
>> --- a/drivers/staging/erofs/unzip_vle.c
>> +++ b/drivers/staging/erofs/unzip_vle.c
>> @@ -1314,7 +1314,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
>>  	LIST_HEAD(pagepool);
>>  
>>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
>> -	f.cachedzone_la = page->index << PAGE_SHIFT;
>> +	f.cachedzone_la = (erofs_off_t)page->index << PAGE_SHIFT;
>>  #endif
>>  	err = z_erofs_do_read_page(&f, page, &pagepool);
>>  	(void)z_erofs_vle_work_iter_end(&f.builder);
>> @@ -1347,7 +1347,7 @@ static inline int __z_erofs_vle_normalaccess_readpages(
>>  	LIST_HEAD(pagepool);
>>  
>>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
>> -	f.cachedzone_la = lru_to_page(pages)->index << PAGE_SHIFT;
>> +	f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT;
>>  #endif
>>  	for (; nr_pages; --nr_pages) {
>>  		struct page *page = lru_to_page(pages);
>>
> 

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

* [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s}
  2018-08-23 11:16   ` Gao Xiang
@ 2018-08-23 11:31     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-08-23 11:31 UTC (permalink / raw)


Hi Xiang,

On 2018/8/23 19:16, Gao Xiang wrote:
> Hi Chao,
> 
> On 2018/8/23 19:02, Chao Yu wrote:
>> On 2018/8/23 17:19, Gao Xiang wrote:
>>> As Dan reported in the LKP mailing list:
>>> https://lists.01.org/pipermail/kbuild-all/2018-August/051558.html
>>>
>>> New smatch warnings:
>>> drivers/staging/erofs/unzip_vle.c:1359 z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?
>>>
>>> Old smatch warnings:
>>> drivers/staging/erofs/unzip_vle.c:1322 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?
>>>
>>> It needs to cast variable's type to erofs_off_t before left shifting.
>>>
>>> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
>>> Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
>>
>> Reviewed-by: Chao Yu <yuchao0 at huawei.com>
>>
>>> ---
>>>
>>> Hi Chao,
>>>
>>> This patch is based on
>>> `staging: erofs: fix potential overflow in erofs_grab_bio()'
>>> in order to avoid patch conflict when rebasing.
>>>
>>> I think it is better to rearrange the commit order in the erofs branch and
>>> it needs to be sent separately in advance to Greg.
>>
>> Agreed, let me add this into erofs branch later.
>>
>> Thanks,
> 
> OK, I will send to Greg appended to the upstream commit
> `staging: erofs: fix potential overflow in erofs_grab_bio()`
> after you add this into erofs branch and receive the successful daily lkp report.

It's okay to me, please go ahead as you plan.

Thanks,

> 
> Thanks,
> Gao XIang
> 
>>
>>>
>>> Thanks,
>>> Gao Xiang
>>>
>>>  drivers/staging/erofs/unzip_vle.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
>>> index 6c4c928..22f9a02 100644
>>> --- a/drivers/staging/erofs/unzip_vle.c
>>> +++ b/drivers/staging/erofs/unzip_vle.c
>>> @@ -1314,7 +1314,7 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
>>>  	LIST_HEAD(pagepool);
>>>  
>>>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
>>> -	f.cachedzone_la = page->index << PAGE_SHIFT;
>>> +	f.cachedzone_la = (erofs_off_t)page->index << PAGE_SHIFT;
>>>  #endif
>>>  	err = z_erofs_do_read_page(&f, page, &pagepool);
>>>  	(void)z_erofs_vle_work_iter_end(&f.builder);
>>> @@ -1347,7 +1347,7 @@ static inline int __z_erofs_vle_normalaccess_readpages(
>>>  	LIST_HEAD(pagepool);
>>>  
>>>  #if (EROFS_FS_ZIP_CACHE_LVL >= 2)
>>> -	f.cachedzone_la = lru_to_page(pages)->index << PAGE_SHIFT;
>>> +	f.cachedzone_la = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT;
>>>  #endif
>>>  	for (; nr_pages; --nr_pages) {
>>>  		struct page *page = lru_to_page(pages);
>>>
>>
> 
> .
> 

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

end of thread, other threads:[~2018-08-23 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23  9:19 [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{, s} Gao Xiang
2018-08-23 11:02 ` [PREVIEW] [PATCH] staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s} Chao Yu
2018-08-23 11:16   ` Gao Xiang
2018-08-23 11:31     ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.