Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp488759pxf; Wed, 31 Mar 2021 08:20:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV1idePwwI4vrW3a1N2udA298qULBpXtApQunhKs5pcTm0jE5FFYRdiDrR57oM/AwlCUtM X-Received: by 2002:a17:906:4747:: with SMTP id j7mr4036018ejs.221.1617204059025; Wed, 31 Mar 2021 08:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617204059; cv=none; d=google.com; s=arc-20160816; b=H1Ldb8ze3mD6WmED1hZmO9WpJZbfRYohufHouxnkQZfDCc5DY9fR10cS4Af+xy1KIP JPeH5FPYw6dHHLsUYf+Qgwr8MjoKNDvxEvtZcOVgEFCqOUNnKixzPwBt5O3aa1jmfLG6 OEC2hJv4ufqC82RHvKTOfSQ0f2snL2xYCh6x3nh0j2X2VmMsf0al5IyquMehzxvuDy9/ 2zgl8XDDsTdeGeKL/2xPioj0D3Rjpj22uDG+wJKnfZT7vOuthIakY2R9DcjvKYRM2T7T dUWFvNro6IBdvjcbfcFFdO7IEg5JvOBMggiiATBK3reigaZR5BMlRAn7F5SzuC2Qp5jH FC4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:cc:subject:from:to; bh=64HR0RjxsxHIvt2E9HsNxyrblYGoWOgT02ovoc9wa18=; b=0+HRUstKztiSd2VeEnrOx/u4WZjv456P8W/EpA1xvbeLVZ73Hc45nSamzYK+kZWIrk PBVmHkd///OeA03mQVbJfMCW3ynARgOI+g1cJ7CCb0nsxvAeR5T/NjChDclCknpBXoxZ RSD9h89Kl3l2vJydFcgQcDJ8BhqZ0V5qQ9Tzd2/o9cFg3FODvEazeomk5usxG4hKm/uZ QjKeVLBnX5+/BY0smXG5hFEIdhogQb1b5gT9zL/XtTVhnGluFCcyxNADsmSszjeZbs55 AffvuG4+rUqmmVHJ+iQkub30bqYPV10/mXyqzVSRkWWFpGHtIf13zZyw03j8GP5H4eoI XbLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si1922026ejh.597.2021.03.31.08.20.36; Wed, 31 Mar 2021 08:20:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236338AbhCaPRh (ORCPT + 99 others); Wed, 31 Mar 2021 11:17:37 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:57266 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236320AbhCaPR0 (ORCPT ); Wed, 31 Mar 2021 11:17:26 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lRcay-0003ue-RA; Wed, 31 Mar 2021 15:17:24 +0000 To: Jaroslav Kysela From: Colin Ian King Subject: re: ALSA: control - add layer registration routines Cc: Takashi Iwai , Mark Brown , Takashi Sakamoto , alsa-devel@alsa-project.org, "linux-kernel@vger.kernel.org" Message-ID: <96e9bd5c-c8db-0db8-b393-fbf4a047dc80@canonical.com> Date: Wed, 31 Mar 2021 16:17:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Static analysis on linux-next with Coverity has detected a potential issue in the following commit: commit 3f0638a0333bfdd0549985aa620f2ab69737af47 Author: Jaroslav Kysela Date: Wed Mar 17 18:29:41 2021 +0100 ALSA: control - add layer registration routines The static analysis is as follows: 2072 void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops) 2073 { 2074 struct snd_ctl_layer_ops *lops2, *prev_lops2; 2075 2076 down_write(&snd_ctl_layer_rwsem); assignment: Assigning: prev_lops2 = NULL. 2077 for (lops2 = snd_ctl_layer, prev_lops2 = NULL; lops2; lops2 = lops2->next) 2078 if (lops2 == lops) { null: At condition prev_lops2, the value of prev_lops2 must be NULL. dead_error_condition: The condition !prev_lops2 must be true. 2079 if (!prev_lops2) 2080 snd_ctl_layer = lops->next; 2081 else 'Constant' variable guards dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: prev_lops2->next = lops->next;. Local variable prev_lops2 is assigned only once, to a constant value, making it effectively constant throughout its scope. If this is not the intent, examine the logic to see if there is a missing assignment that would make prev_lops2 not remain constant. 2082 prev_lops2->next = lops->next; 2083 break; 2084 } 2085 up_write(&snd_ctl_layer_rwsem); 2086 } I couldn't quite figure out the original intent of the prev_lops use, so I'd thought I'd report this issue as the code does look incorrect. Colin