Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1482179 > unrolled thread

Re: [PATCH] xfs: fix signed integer overflow

Started byDave Chinner <david@fromorbit.com>
First post2016-09-13 09:00 +0200
Last post2016-09-13 09:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] xfs: fix signed integer overflow Dave Chinner <david@fromorbit.com> - 2016-09-13 09:00 +0200
    Re: [PATCH] xfs: fix signed integer overflow Xie XiuQi <xiexiuqi@huawei.com> - 2016-09-13 09:30 +0200

#1482179 — Re: [PATCH] xfs: fix signed integer overflow

FromDave Chinner <david@fromorbit.com>
Date2016-09-13 09:00 +0200
SubjectRe: [PATCH] xfs: fix signed integer overflow
Message-ID<sgPRf-6Fc-9@gated-at.bofh.it>
On Fri, Sep 09, 2016 at 03:16:48PM +0800, Xie XiuQi wrote:
> On 2016/9/9 14:42, Joe Perches wrote:
> > On Fri, 2016-09-09 at 14:38 +0800, Xie XiuQi wrote:
> >> Use 1U for unsigned long, or we'll meet a overflow issue with UBSAN.
> > 
> > trivia: misleading commit message
> > 
> > 1U is for unsigned int not unsigned long int
> > 
> 
> Sorry, my fault. Thank you for your comments.
> 
> From 9cb8e36406a54ce0eaade31dd28f6068f03de1d2 Mon Sep 17 00:00:00 2001
> From: Xie XiuQi <xiexiuqi@huawei.com>
> Date: Tue, 6 Sep 2016 11:15:34 +0800
> Subject: [PATCH v2] xfs: fix signed integer overflow
....
> ---
>  fs/xfs/xfs_buf_item.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index e455f90..3a27997 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -865,7 +865,7 @@ xfs_buf_item_log_segment(
>          */
>         if (bit) {
>                 end_bit = MIN(bit + bits_to_set, (uint)NBWORD);
> -               mask = ((1 << (end_bit - bit)) - 1) << bit;
> +               mask = ((1U << (end_bit - bit)) - 1) << bit;
>                 *wordp |= mask;
>                 wordp++;
>                 bits_set = end_bit - bit;

This patch is whitespace damaged and fails to apply. I've fixed it
up as this is a trivial change. However, please fix the problem
before you submit more patches.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

[toc] | [next] | [standalone]


#1482198

FromXie XiuQi <xiexiuqi@huawei.com>
Date2016-09-13 09:30 +0200
Message-ID<sgQkh-77I-1@gated-at.bofh.it>
In reply to#1482179
On 2016/9/13 14:57, Dave Chinner wrote:
> On Fri, Sep 09, 2016 at 03:16:48PM +0800, Xie XiuQi wrote:
>> On 2016/9/9 14:42, Joe Perches wrote:
>>> On Fri, 2016-09-09 at 14:38 +0800, Xie XiuQi wrote:
>>>> Use 1U for unsigned long, or we'll meet a overflow issue with UBSAN.
>>> trivia: misleading commit message
>>>
>>> 1U is for unsigned int not unsigned long int
>>>
>> Sorry, my fault. Thank you for your comments.
>>
>> From 9cb8e36406a54ce0eaade31dd28f6068f03de1d2 Mon Sep 17 00:00:00 2001
>> From: Xie XiuQi <xiexiuqi@huawei.com>
>> Date: Tue, 6 Sep 2016 11:15:34 +0800
>> Subject: [PATCH v2] xfs: fix signed integer overflow
> ....
>> ---
>>  fs/xfs/xfs_buf_item.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
>> index e455f90..3a27997 100644
>> --- a/fs/xfs/xfs_buf_item.c
>> +++ b/fs/xfs/xfs_buf_item.c
>> @@ -865,7 +865,7 @@ xfs_buf_item_log_segment(
>>          */
>>         if (bit) {
>>                 end_bit = MIN(bit + bits_to_set, (uint)NBWORD);
>> -               mask = ((1 << (end_bit - bit)) - 1) << bit;
>> +               mask = ((1U << (end_bit - bit)) - 1) << bit;
>>                 *wordp |= mask;
>>                 wordp++;
>>                 bits_set = end_bit - bit;
> This patch is whitespace damaged and fails to apply. I've fixed it
> up as this is a trivial change. However, please fix the problem
> before you submit more patches.

I will, thank you very mush.

>
> Cheers,
>
> Dave.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web