From patchwork Tue Jun 16 18:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxiao Bi X-Patchwork-Id: 11608437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C249912 for ; Tue, 16 Jun 2020 18:42:16 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 643482082F for ; Tue, 16 Jun 2020 18:42:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QpKiid/p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 643482082F Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05GIWpmH125645; Tue, 16 Jun 2020 18:42:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : date : message-id : in-reply-to : references : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : content-type : content-transfer-encoding : sender; s=corp-2020-01-29; bh=YS11wqiDZfDQzSWDSeAJLoaLfXVzhuhWzPlQ65x97js=; b=QpKiid/pUb384S4lIMxiO/T+nRgeEv5ljKui9dyUnnuMs2wCm2lB9JYLoXEf+RL06rqj CTbgVjt6IX5mBZ/y+PcVN0skk73ztRlykFMvBbSDDtTUp5EvjGrWM6WeVftG/WmGTIPv 1kLdNxctrov9vnwQvKD/YS4w+vyENeAtq39I8wBRK40iz7aIwBo2fUSLWF7+hHcu+5Ta 8HNVv40Aty+C5SzU+dxXZ5fT5Ifg73u6iO1d0yTOVSnJRfFPt8CWtzUv456OuSvX0L1b lF1KCKLhsufxb9ov9sxxrxY8d7Ua2ONcV76vOwJp/A9vt7PRH1yj28ay7fEiJKq7WoUK lg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 31p6e80fq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 16 Jun 2020 18:42:01 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05GIYD7m114101; Tue, 16 Jun 2020 18:40:01 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 31p6s8034m-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Tue, 16 Jun 2020 18:40:01 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jlGV6-00055l-6y; Tue, 16 Jun 2020 11:40:00 -0700 Received: from userp3030.oracle.com ([156.151.31.80]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1jlGUM-00052N-U8 for ocfs2-devel@oss.oracle.com; Tue, 16 Jun 2020 11:39:15 -0700 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05GIYC3B113858 for ; Tue, 16 Jun 2020 18:39:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 31p6s802g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 16 Jun 2020 18:39:14 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05GIZYpv117649 for ; Tue, 16 Jun 2020 18:39:14 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 31p6s802fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Jun 2020 18:39:14 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05GIdDKn017266; Tue, 16 Jun 2020 18:39:13 GMT Received: from dhcp-10-159-233-17.vpn.oracle.com (/10.159.233.17) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Jun 2020 11:39:13 -0700 From: Junxiao Bi To: ocfs2-devel@oss.oracle.com Date: Tue, 16 Jun 2020 11:38:29 -0700 Message-Id: <20200616183829.87211-5-junxiao.bi@oracle.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20200616183829.87211-1-junxiao.bi@oracle.com> References: <20200616183829.87211-1-junxiao.bi@oracle.com> MIME-Version: 1.0 Subject: [Ocfs2-devel] [PATCH 4/4] ocfs2: fix value of OCFS2_INVALID_SLOT X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9654 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006160131 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9654 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 cotscore=-2147483648 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006160131 >From ocfs2 disk layout, slot number is 16 bits, but in ocfs2 implemtation, slot number is 32 bits, usually this will not cause any issue, because slot number is converting from u16 to u32, but OCFS2_INVALID_SLOT was defined as -1, when an invalid slot number from disk was got, it value was (u16)-1, and it was converted to u32, then the following checking in get_local_system_inode will be always skipped. static struct inode **get_local_system_inode(struct ocfs2_super *osb, int type, u32 slot) { BUG_ON(slot == OCFS2_INVALID_SLOT); ... } Signed-off-by: Junxiao Bi Reviewed-by: Joseph Qi --- fs/ocfs2/ocfs2_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 3fc99659ed09..19137c6d087b 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h @@ -290,7 +290,7 @@ #define OCFS2_MAX_SLOTS 255 /* Slot map indicator for an empty slot */ -#define OCFS2_INVALID_SLOT -1 +#define OCFS2_INVALID_SLOT ((u16)-1) #define OCFS2_VOL_UUID_LEN 16 #define OCFS2_MAX_VOL_LABEL_LEN 64