From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7AB93537E3 for ; Fri, 3 Apr 2026 08:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775204866; cv=none; b=WPTRb/iupW3/7UTVh18sQUD1jNiFaW5+dk/d5VD3G7zaz5EoXqF+H25S6Bs1Ofuk2HdXJXcdphRYOFCbDeArfZC9lDzBPcSS9jT8UYFkzPw/AC2BrZxKU1AuTPOrHsPBArqYi/iIIvUtQlgx0/JhPKmtHf27WbK+FrV/+P6yQJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775204866; c=relaxed/simple; bh=i/wRbAOc7/icH1RWjSVnTilQ/EVPgxOOeou170VxSfc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sEfDkpRIghBD2k2qtV/lOTcvDiO+GKf/eIOdqbpLP3gZvZn/FwNhBQWaQ+QiPV4xTwbBaN/6XBb7aMMdDrQg/rUUp9ondYiU7QJwxWshZAsr9fkD1A3P3wEsEew/kFOPbMbZOUOqwxZOjAETYwWOF+s1Aw95u6SSUuqQimZHeMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=YFGNNldo; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="YFGNNldo" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775204853; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=WwIVq++6ZGZSOsvQFz6ZBP7JWcltK+ZVE+dMkEeDzmM=; b=YFGNNldoGhp9KU9cVNtVCFcXDSbW9rSm/Az03JBxwALih0lqeLOgKL2CbJdI6yDdiDSUZG9tdtaKHoVDvvV4cu3SewKqxcY4HIIb7TM2benFZ+Kty2F0AAsycF4iyU5ryYhaFiGHMXYDnps50khz3E5jmZONtPaAsx/734QmlWE= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R351e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0X0JhcaF_1775204851; Received: from 30.41.54.139(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X0JhcaF_1775204851 cluster:ay36) by smtp.aliyun-inc.com; Fri, 03 Apr 2026 16:27:32 +0800 Message-ID: Date: Fri, 3 Apr 2026 16:27:31 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] erofs: handle 48-bit blocks/uniaddr for extra devices To: Zhan Xusheng , Gao Xiang Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Zhan Xusheng References: <20260403063658.72140-1-zhanxusheng@xiaomi.com> From: Gao Xiang In-Reply-To: <20260403063658.72140-1-zhanxusheng@xiaomi.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026/4/3 14:36, Zhan Xusheng wrote: > erofs_init_device() only reads blocks_lo and uniaddr_lo from the > on-disk device slot, ignoring blocks_hi and uniaddr_hi that were > introduced alongside the 48-bit block addressing feature. > > For the primary device (dif0), erofs_read_superblock() already handles > this correctly by combining blocks_lo with blocks_hi when 48-bit > layout is enabled. But the same logic was not applied to extra > devices. > > With a 48-bit EROFS image using extra devices whose uniaddr or blocks > exceed 32-bit range, the truncated values cause erofs_map_dev() to > compute wrong physical addresses, leading to silent data corruption. > > Fix this by reading blocks_hi and uniaddr_hi in erofs_init_device() > when 48-bit layout is enabled, consistent with the primary device > handling. Also fix the erofs_deviceslot on-disk definition where > blocks_hi was incorrectly declared as __le32 instead of __le16. > > Fixes: 61ba89b57905 ("erofs: add 48-bit block addressing on-disk support") > Suggested-by: Gao Xiang > Signed-off-by: Zhan Xusheng Thanks, Reviewed-by: Gao Xiang Thanks, Gao Xiang