From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71FFBC433FE for ; Sat, 21 May 2022 06:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354703AbiEUGtZ (ORCPT ); Sat, 21 May 2022 02:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbiEUGtY (ORCPT ); Sat, 21 May 2022 02:49:24 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 490C79728A; Fri, 20 May 2022 23:49:23 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3C11421B9F; Sat, 21 May 2022 06:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1653115761; h=from:from:reply-to: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=jvKzZqSyzLuvq1BOT4+dzaCOcfHBWt+sXaEiI2nPk0g=; b=GYQuLlXl4spbIzkf0nKYMFRo/R6BeEKznF8Oqta0WaGywCIKI+Qz5o8IfeZcYPLEyMDWme rx9xgj9GdHkK7Q+IIS1zo3FLf0XYaEsw+vTe7tSUunAVwDkT1YPCS6Z0E2HLNsXGw/QoE8 ObdMo3jYzO+aJ04LJJV0S3GCvANubPM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1653115761; h=from:from:reply-to: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=jvKzZqSyzLuvq1BOT4+dzaCOcfHBWt+sXaEiI2nPk0g=; b=z0ZKNFWS0D+WJZEdubGQCF3+jyLihjH+jyFxv9+8PdBl9VVlNc4pGE2/vjUI1/wGdova54 gshgR1uQv2eRGyBQ== Received: from valkyrie.site.suse.de (unknown [10.163.18.242]) by relay2.suse.de (Postfix) with ESMTP id 1A96D2C141; Sat, 21 May 2022 06:49:21 +0000 (UTC) Date: Sat, 21 May 2022 08:49:20 +0200 Message-ID: <87wnefnzwv.wl-tiwai@suse.de> From: Takashi Iwai To: Kees Cook Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ALSA: lola: Bounds check loop iterator against streams array size In-Reply-To: <20220520165537.2139826-1-keescook@chromium.org> References: <20220520165537.2139826-1-keescook@chromium.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/27 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 May 2022 18:55:37 +0200, Kees Cook wrote: > > GCC 12 sees that it's technically possible for num_streams to be larger > than ARRAY_SIZE(pcm->streams). Bounds-check the iterator. > > ../sound/pci/lola/lola_pcm.c: In function 'lola_pcm_update': > ../sound/pci/lola/lola_pcm.c:567:64: warning: array subscript [0, 31] is outside array bounds of 'struct lola_stream[16]' [-Warray-bounds] > 567 | struct lola_stream *str = &pcm->streams[i]; > | ~~~~~~~~~~~~^~~ > In file included from ../sound/pci/lola/lola_pcm.c:15: > ../sound/pci/lola/lola.h:307:28: note: while referencing 'streams' > 307 | struct lola_stream streams[MAX_STREAM_COUNT]; > | ^~~~~~~ > > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: alsa-devel@alsa-project.org > Signed-off-by: Kees Cook Thanks, applied now. Takashi