Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5424641pxb; Mon, 28 Mar 2022 12:17:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6xx7SZ2XC13cD69qo5IIJAJ9M+672Az5f96yRqNE79jhLtvfBc1HIZqemMT8v6gYKDZCQ X-Received: by 2002:a17:906:6a1b:b0:6e0:b38b:f74c with SMTP id qw27-20020a1709066a1b00b006e0b38bf74cmr20206199ejc.46.1648495070216; Mon, 28 Mar 2022 12:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648495070; cv=none; d=google.com; s=arc-20160816; b=Be+gsDRaehW+kfixRuJ7nBIqfdOjNTf8xOeS4jHqRJfnEHoI7W0AUgQ4LQ2rG9pr8N t3zAX2rPa+q+0s7LDmbyDeWafS6jrg31t+FKoQXWlQgIIMX5cLosgotabYFxOt85T1cg LTH9ciHDo0uwkG9VHcqNMF4EHsX32iemnEYgCK5RzLUJYUpR6Ye2XoAhSML/UL9HJhNY eGrHvRdzL5DDpz5U60sbVlDGaRjju5ahrBsGCcv6X1Xk1taGEMqrOD+FssMAODm4NDN5 YT+sQBCuXrnKFE6omCdXfu0RxygXZnWB1x4IhEbuEMmu/uMEWIbIIZ81DbYnEX5y8T50 Ly0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=HasCxMsdY3sivfE+or7HaqLHWRxJkiKaDq90gjx6H0I=; b=O7DRoOduBw5KksANhAt430wDTrgf9smtRTfRQkcBOqYT8U1NKhfP5bqbCu3o3T65Ij e+jt6DD/RrAZdDZ+S89YCLb8MJ5DMEjEONf7wuRyJs5iOU5WRaul1GmJYSorXKm0RLHE J4RbevyS+84/31qgQE472rqu4dtXjOOiyuAXFXxgnKacEYoJwdKI2BUd9BcIL/jfELjz OdE2EBYQL6atm/r7QqMq4afGz4ztL66yfXBCfbdxPdDXzQ83n3E6JVA90HNuA5uxSXFD /CCo+IspZMIfDf44VBdOHJU9mzMO7AGts8ccHNpSUZjZeLH6b5ArmeC3Cd8GBVe05bbi 19ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@animalcreek.com header.s=fm2 header.b=ZwSnWxl7; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=MkPhGsM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa7c242000000b00418c2b5bedcsi15125196edo.446.2022.03.28.12.17.23; Mon, 28 Mar 2022 12:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@animalcreek.com header.s=fm2 header.b=ZwSnWxl7; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=MkPhGsM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236517AbiC0T0q (ORCPT + 99 others); Sun, 27 Mar 2022 15:26:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231214AbiC0T0o (ORCPT ); Sun, 27 Mar 2022 15:26:44 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE17DE01A; Sun, 27 Mar 2022 12:25:04 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 3548632007F9; Sun, 27 Mar 2022 15:25:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 27 Mar 2022 15:25:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; bh=HasCxMsdY3sivfE+or7HaqLHWRxJki KaDq90gjx6H0I=; b=ZwSnWxl7jcXn+641XqZnpD50/fvaMMcghJQPvJRTbQBNfU O0MSCiv+v/rcHhWvisrThtgpx21yhl3U4ELo7k4DborSnolwubmJOe0SuAR7O/dO jFACICVJC0BOVU81OPDmdpndQIGtiIm2si2jlOicj5DrCmnIPbgJVywsr4t9s7M7 Rjj2/eoB1Ub1y3Xcpg+FQeFhd8XoYhfS5FNFDM/5OHjMIyBurSfS5BNl/q0ECRCN FY7dSziiJ6CeX0rn22nfoBsQIIsdAXmcQcPzewPGnDHSRmO8LqkeJ9nKGCVA7Rgg A6LQx/9ozqCN/3fUZAp/P3YFKFLx0H+6RQHlp03w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=HasCxMsdY3sivfE+o r7HaqLHWRxJkiKaDq90gjx6H0I=; b=MkPhGsM2Vml+HKd9dRvlKVuef8E9l9AFp cHMcrX4GFxG2uCzX+X2bKcGN0CboclTtma3d5N0rarMuRXzLWchBOIlVsrrpI+Nl IiFIUrZUbltVNMfqFf2zNQYNWKAlvnToBmF9LSZWHDRf4hTweOjP4GqaA338OJzA vaGNasdxJfAKsAWiE3p1s2Eaz6ETPqcm4P9CbqAsxUiVKcpsOE1qCfCg9yarL5IC qToFtAa0Uaqi5rBDgb9kBxhhLBxljA1aUmZFADeW8K40DefpxU48RNGCLLCor42D QBpQlnDYBOaBwQc7PBqQ9V0mpRf6AHkzx8wlHVFNHunwg1ibHhS5A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudehhedgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujghosehttdertddttddvnecuhfhrohhmpeforghr khcuifhrvggvrhcuoehmghhrvggvrhesrghnihhmrghltghrvggvkhdrtghomheqnecugg ftrfgrthhtvghrnhepieeugfdutdefiedtvdfftedufedvjeehgfevveefudfgjeffgeei teetjedufffhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepmhhgrhgvvghrsegrnhhimhgrlhgtrhgvvghkrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 27 Mar 2022 15:25:00 -0400 (EDT) Received: by blue.animalcreek.com (Postfix, from userid 1000) id 9EDD813601FE; Sun, 27 Mar 2022 12:24:59 -0700 (MST) Date: Sun, 27 Mar 2022 12:24:59 -0700 From: Mark Greer To: Xiaomeng Tong Cc: vaibhav.sr@gmail.com, mgreer@animalcreek.com, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] greybus: audio_codec: fix three missing initializers for data Message-ID: <20220327192459.GA220029@animalcreek.com> References: <20220327060120.4316-1-xiam0nd.tong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220327060120.4316-1-xiam0nd.tong@gmail.com> Organization: Animal Creek Technologies, Inc. X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Sun, Mar 27, 2022 at 02:01:20PM +0800, Xiaomeng Tong wrote: > These three bugs are here: > struct gbaudio_data_connection *data; > > If the list '&codec->module_list' is empty then the 'data' will > keep unchanged. However, the 'data' is not initialized and filled > with trash value. As a result, if the value is not NULL, the check > 'if (!data) {' will always be false and never exit expectly. > > To fix these bug, just initialize 'data' with NULL. > > Cc: stable@vger.kernel.org > Fixes: 6dd67645f22cf ("greybus: audio: Use single codec driver registration") > Signed-off-by: Xiaomeng Tong > --- > drivers/staging/greybus/audio_codec.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c > index b589cf6b1d03..939e05af4dcf 100644 > --- a/drivers/staging/greybus/audio_codec.c > +++ b/drivers/staging/greybus/audio_codec.c > @@ -397,7 +397,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream, > u8 sig_bits, channels; > u32 format, rate; > struct gbaudio_module_info *module; > - struct gbaudio_data_connection *data; > + struct gbaudio_data_connection *data = NULL; > struct gb_bundle *bundle; > struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev); > struct gbaudio_stream_params *params; > @@ -498,7 +498,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream, > { > int ret; > struct gbaudio_module_info *module; > - struct gbaudio_data_connection *data; > + struct gbaudio_data_connection *data = NULL; > struct gb_bundle *bundle; > struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev); > struct gbaudio_stream_params *params; > @@ -562,7 +562,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream, > static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream) > { > int ret; > - struct gbaudio_data_connection *data; > + struct gbaudio_data_connection *data = NULL; > struct gbaudio_module_info *module; > struct gb_bundle *bundle; > struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev); > -- > 2.17.1 Those changes appear to fix real bugs. Thanks Xiaomeng. Reviewed-by: Mark Greer