From patchwork Thu May 20 08:34:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 12269463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D28B4C433ED for ; Thu, 20 May 2021 08:35:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4105761184 for ; Thu, 20 May 2021 08:35:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4105761184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 36E70166E; Thu, 20 May 2021 10:34:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36E70166E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621499729; bh=mcZxyHe9Rtk4F5k0SdyefvLAED8uANoneyfkYvoKQOk=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=IaHGvncpTNSMIuMltf6li0WJK1+9CMdq7m8fVKFmwLU2sTa/8CAzd8lvFhghZFEUo ps5SrotcfPLDY6YbbXvSU+ZsoMWgJK2XG3e2iUsSgZPnpU/Ch8riHg8ecRwDQmenvb 8Sd+jF1LGldrEz7zUIzslGQSy8+1J/nDBxexVJHY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B6E00F8020B; Thu, 20 May 2021 10:34:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6B498F80217; Thu, 20 May 2021 10:34:37 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 52C0BF800C1 for ; Thu, 20 May 2021 10:34:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 52C0BF800C1 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lje8P-00027g-0B; Thu, 20 May 2021 08:34:25 +0000 From: Colin King To: Clemens Ladisch , Takashi Sakamoto , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org Subject: [PATCH][next] ALSA: firewire-lib: Fix uninitialized variable err issue Date: Thu, 20 May 2021 09:34:24 +0100 Message-Id: <20210520083424.6685-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Colin Ian King Currently in the case where the payload_length is less than the cip_header_size the error return variable err is not being set and function parse_ir_ctx_header can return an uninitialized error return value. Fix this by setting err to zero. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: c09010eeb373 ("ALSA: firewire-lib: handle the case that empty isochronous packet payload for CIP") Signed-off-by: Colin Ian King Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index af5c3629f1ac..242b1147d768 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -663,6 +663,7 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, } else { // Handle the cycle so that empty packet arrives. cip_header = NULL; + err = 0; *data_blocks = 0; *syt = 0; }