Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3291172lfo; Mon, 23 May 2022 00:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt9nCkLEpxfJn5z/aiXMiG9aSk9MJoY4kgcam/Yw06tZ0E3mbZ/DGR0NQiKk+8pO0FN/MF X-Received: by 2002:a17:90a:5603:b0:1df:27ea:73b2 with SMTP id r3-20020a17090a560300b001df27ea73b2mr25014555pjf.227.1653292317327; Mon, 23 May 2022 00:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653292317; cv=none; d=google.com; s=arc-20160816; b=pCfZ28xRRn3GqqKPZTLQVwwHMXxuuLeZD0tjO1Us9SOGR/B0BdexC2/BBH/Dwp/7VO gtr1z0rh+aoHCEWt8ixJ1LcV2EpNJlqxNxu7M04m1jnP/pgLtDXmQ+FtubWh0I5Nkvw/ N2a5MEUwLcOrs8052FVxsuNW/nfyV1AMW0FXi68IQwGB6bAMmWbhzrsMaPO4aYZnMfmC vkQgaTfc/HaGNaIdFstLSMdbq8oQeQ0gf6er509ItVewLZRmsgl5fl1lAUqmRO3wCjca HXvRfKnymHxXzz5F+PoLQ5Lmee6x+oMivELtoFJtumI+L4vNMMMovhkzA5Kqo/Fs7abl B70g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=jvKzZqSyzLuvq1BOT4+dzaCOcfHBWt+sXaEiI2nPk0g=; b=kGMN3LrQa8moPd/eBAHyI75c1uothBkXOL1PpqbwuzeMvcMzMMJtKUxtR8MTawaox5 a1ItG5+Trpw3aUxF1N1ov5h2lk1IAF321moLlHyOxGVV07URFcPRh7LFZgWrCJGh/ec8 Hh49LbNTlu6F+OG6RqF9gf+GmbKvUdOSy+sU0VchjN+idcL4GsfHAuQRCB3wGR8IvCdK JRx8a3pahKWUMPp8LqXa8ZHCnt3eFqraqSA37Est2q3ZknZqvRA8twibmSmrZJuckGtg 9stl+Ox8tZrOuLCAPXQ9YeY2oRq++dfaMw17ScRs94c2X04w7v3mgqEjKnFsSIvW+Nw/ o2PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GYQuLlXl; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id qe13-20020a17090b4f8d00b001cb7af1047esi14448227pjb.100.2022.05.23.00.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GYQuLlXl; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0912923F3B9; Sun, 22 May 2022 23:57:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354699AbiEUGtZ (ORCPT + 99 others); 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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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