From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754731AbcIMHYM (ORCPT ); Tue, 13 Sep 2016 03:24:12 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:2088 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbcIMHYJ (ORCPT ); Tue, 13 Sep 2016 03:24:09 -0400 Subject: Re: [PATCH] xfs: fix signed integer overflow To: Dave Chinner References: <1473403112-31072-1-git-send-email-xiexiuqi@huawei.com> <1473403321.13672.35.camel@perches.com> <57D261E0.7080005@huawei.com> <20160913065738.GF30497@dastard> CC: Joe Perches , , From: Xie XiuQi Message-ID: <57D7A97B.4080901@huawei.com> Date: Tue, 13 Sep 2016 15:23:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20160913065738.GF30497@dastard> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.210] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.57D7A986.0013,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3cba011c77b90550c1bafe879c6a02a2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> 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.