From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.parknet.co.jp (mail.parknet.co.jp [210.171.160.6]) (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 7E3C619F12D for ; Wed, 3 Jun 2026 06:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.171.160.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780467376; cv=none; b=tN67uJWMcjasKaDa67Ll7NdzBeDQnC/g8pMC7z8uuH+Yn/EiY/nqGb+ixy/dlNU7TF+uwvywAVDFHJGRJj4pJW8MmjOfTd6yJAVkXkcma0MfPDoe+bVH39vOhA5Kix5aAtgHS7vjWEu1BAi98Du6U+WlbqtkeqK9gUKIxiXUs7A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780467376; c=relaxed/simple; bh=/Zw+o2WkL0eNo2Gkcm/Oc/D8ZYQhr5H3j7rzB1mQRaw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=RIZ+FtjTNHnaLCZ5c6hZAeaOdPBK7p5eT/iVC/vGgi+Ddnf/+dyJse/v+tvYmyw0AIGF+1U88IpM3NXF/Ye9/RLY+LS57FX4D12JAHOXh97v8TGYBZGI/U5v5Bt6JJShE03620yS0yWKgwZ0zSosFofFVDxkU1idEV94X6RV/oY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.parknet.co.jp; spf=pass smtp.mailfrom=parknet.co.jp; dkim=pass (2048-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b=oxmtppP0; dkim=permerror (0-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b=8IRYfg3P; arc=none smtp.client-ip=210.171.160.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.parknet.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=parknet.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b="oxmtppP0"; dkim=permerror (0-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b="8IRYfg3P" Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 977AA26F7667; Wed, 3 Jun 2026 15:16:11 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=parknet.co.jp; s=20250114; t=1780467371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j2nepxY8sTFpizu1pIjBFW82ffLVW/N+c9ZPEEFhdws=; b=oxmtppP0jqHxvf89P3sob1X9VGX9yrnft2adpmW+tX2pOJkImNEfksqBVxGX4m+AFwfn2t q8onLgMK42UuNVNU/lnR+SW3+mli6aCTnf3r6llHtF7+LwCGtdsHbrlQipgqBoR5QQA2vE 5NCFRaGHiEdP/+Y7/DRXvNNQftXTQ/i1aMo14aXeaE2vHdguwgRXA+0kW7yiAjyfXGAswU lP7Gh/Ej4kweHToJBGnD175ieNEkr4kqI3/LfFajJvS0nyNn3FbJI8VJco7DfzqhBdhoUq wvHsGQg95DkeDuvLIFssGKHgMloLo1/ku7FiDftPDpVo1vXfiGrMI9zzG3PIJA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=parknet.co.jp; s=20250114-ed25519; t=1780467371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j2nepxY8sTFpizu1pIjBFW82ffLVW/N+c9ZPEEFhdws=; b=8IRYfg3PYnHeIf09Q9P/7TCOx85E5uMSIdTIyMbxLmJUUYtmQ0bd5B+3noRe8fEUnUhZqe Y+CJMn8G40c5rQDg== Received: from devron.myhome.or.jp (devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (Postfix) with ESMTPS id 25A0BE00222; Wed, 03 Jun 2026 15:16:11 +0900 (JST) Received: by devron.myhome.or.jp (Postfix, from userid 1000) id 17AC72200151; Wed, 03 Jun 2026 15:16:11 +0900 (JST) From: OGAWA Hirofumi To: Andrew Morton Cc: Arnd Bergmann , Arnd Bergmann , Christian Brauner , Jan Kara , avivdaum , Adi Nata , linux-kernel@vger.kernel.org Subject: Re: [PATCH] fat: avoid stack overflow warning In-Reply-To: <20260515204456.2692208-1-arnd@kernel.org> References: <20260515204456.2692208-1-arnd@kernel.org> Date: Wed, 03 Jun 2026 15:16:11 +0900 Message-ID: <87tsrki1xw.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Arnd Bergmann writes: > From: Arnd Bergmann > > Building the fat kunit tests on with -fsanitize=alignment > reveals some rather excessive stack usage: > > fs/fat/fat_test.c: In function 'fat_clus_to_blknr_test': > fs/fat/fat_test.c:33:1: error: the frame size of 4736 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] > 33 | } > | ^ > fs/fat/fat_test.c: In function 'fat_get_blknr_offset_test': > fs/fat/fat_test.c:52:1: error: the frame size of 4800 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] > > The problem is clearly related to the on-stack copy of a local > msdos_sb_info structure. Avoid this by making that copy > 'static const' and changing the called functions to accept > a constant input. Acked-by: OGAWA Hirofumi > Signed-off-by: Arnd Bergmann > --- > fs/fat/fat.h | 4 ++-- > fs/fat/fat_test.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/fat/fat.h b/fs/fat/fat.h > index 5a58f0bf8ce8..52bced59abe4 100644 > --- a/fs/fat/fat.h > +++ b/fs/fat/fat.h > @@ -247,13 +247,13 @@ static inline unsigned char fat_checksum(const __u8 *name) > return s; > } > > -static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) > +static inline sector_t fat_clus_to_blknr(const struct msdos_sb_info *sbi, int clus) > { > return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus > + sbi->data_start; > } > > -static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi, > +static inline void fat_get_blknr_offset(const struct msdos_sb_info *sbi, > loff_t i_pos, sector_t *blknr, int *offset) > { > *blknr = i_pos >> sbi->dir_per_block_bits; > diff --git a/fs/fat/fat_test.c b/fs/fat/fat_test.c > index 4eeed9dca549..9583ce66dca3 100644 > --- a/fs/fat/fat_test.c > +++ b/fs/fat/fat_test.c > @@ -22,7 +22,7 @@ static void fat_checksum_test(struct kunit *test) > > static void fat_clus_to_blknr_test(struct kunit *test) > { > - struct msdos_sb_info sbi = { > + static const struct msdos_sb_info sbi = { > .sec_per_clus = 4, > .data_start = 100, > }; > @@ -34,7 +34,7 @@ static void fat_clus_to_blknr_test(struct kunit *test) > > static void fat_get_blknr_offset_test(struct kunit *test) > { > - struct msdos_sb_info sbi = { > + static const struct msdos_sb_info sbi = { > .dir_per_block = 16, > .dir_per_block_bits = 4, > }; -- OGAWA Hirofumi