From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E4A23ACA7D for ; Mon, 9 Mar 2026 13:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773061982; cv=none; b=RIwObc8UbSyLmjHW4e7x2tZPd4hU+QlTE1VRsDgii/lW2MlwZVYFhvx/ib/ZKUC+sbtz/vQ0NtVD5CfJUDQj7kw3AayfjI2BT8yA5Fzff+d5oryG7RMI1kyQChQzeFYoqLJ7XYxup/3MJyezuNUMj0LlJvjMPPLcnQlKPp/VOkM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773061982; c=relaxed/simple; bh=T4qFY7FaLo6TLAHs/evhC0/XEbBc7h4A2iWsQnpXJLU=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Jxt04yVeDU8EvswLbJUoeVmMhREWkBKia51sWESvKIBjfYoZfLLvfdH2a+UUZ3Rs3aMg/s/rpGmrvziy9o3W47NsKTOVDAk9VsaJVzEiwOcQkTeVsvrFcroLcSxAG3Wfy47ka4qS9rlvS12atmQtIxy4STD0ISojuQiGxvs+b9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8E68B5BD8F; Mon, 9 Mar 2026 13:12:59 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 44AC73EEFA; Mon, 9 Mar 2026 13:12:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MoN8D1vHrmm9dgAAD6G6ig (envelope-from ); Mon, 09 Mar 2026 13:12:59 +0000 Date: Mon, 09 Mar 2026 14:12:58 +0100 Message-ID: <87o6kxm9id.wl-tiwai@suse.de> From: Takashi Iwai To: Thorsten Blum Cc: Takashi Iwai , Johannes Berg , Jaroslav Kysela , Takashi Iwai , Kees Cook , stable@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: aoa: Handle empty codec list in i2sbus_pcm_prepare() In-Reply-To: References: <20260309114159.765304-3-thorsten.blum@linux.dev> <87zf4hmcw4.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 8E68B5BD8F X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Score: -4.00 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org On Mon, 09 Mar 2026 13:55:02 +0100, Thorsten Blum wrote: > > On 9. Mar 2026, at 12:59, Takashi Iwai wrote: > > On Mon, 09 Mar 2026 12:41:59 +0100, Thorsten Blum wrote: > >> Replace two list_for_each_entry() loops with list_first_entry_or_null() > >> in i2sbus_pcm_prepare(). > > > > Hmm, I guess both can be simply list_first_entry(), as the codec list > > in this code path is guaranteed to be non-empty (it's called after > > i2sbus_pcm_open() which has the check of the valid codecs). > > That guarantee only holds for open/prepare, not for i2sbus_resume() via > i2sbus_pcm_prepare_both(). It's probably uncommon in practice, but > i2sbus_pcm_prepare() should still handle it safely. Then we should fix i2sbus_resume() instead. It can simply bail out when the codec list empty. Ditto for i2bus_suspend(). > >> Handle an empty codec list explicitly by returning -ENODEV, which avoids > >> using uninitialized 'bi.sysclock_factor' in the 32-bit code path. > > > > Which 32bit code path are you referring to...? > > The SNDRV_PCM_FORMAT_S32_BE/SNDRV_PCM_FORMAT_U32_BE branch. The description is confusing :) It's about 32bit PCM *format*, not about 32bit code path. thanks, Takashi