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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no 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 D5EF4C43463 for ; Mon, 21 Sep 2020 08:24:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D12920709 for ; Mon, 21 Sep 2020 08:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbgIUIYw (ORCPT ); Mon, 21 Sep 2020 04:24:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:53670 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgIUIYw (ORCPT ); Mon, 21 Sep 2020 04:24:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6010DB288; Mon, 21 Sep 2020 08:25:26 +0000 (UTC) Date: Mon, 21 Sep 2020 10:24:50 +0200 Message-ID: From: Takashi Iwai To: trix@redhat.com Cc: perex@perex.cz, tiwai@suse.com, natechancellor@gmail.com, ndesaulniers@google.com, eblennerhassett@audioscience.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] ALSA: asihpi: fix iounmap in error handler In-Reply-To: <20200913165230.17166-1-trix@redhat.com> References: <20200913165230.17166-1-trix@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (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 Sun, 13 Sep 2020 18:52:30 +0200, trix@redhat.com wrote: > > From: Tom Rix > > clang static analysis flags this problem > hpioctl.c:513:7: warning: Branch condition evaluates to > a garbage value > if (pci.ap_mem_base[idx]) { > ^~~~~~~~~~~~~~~~~~~~ > > If there is a failure in the middle of the memory space loop, > only some of the memory spaces need to be cleaned up. > > At the error handler, idx holds the number of successful > memory spaces mapped. So rework the handler loop to use the > old idx. > > There is a second problem, the memory space loop conditionally > iomaps()/sets the mem_base so it is necessay to initize pci. > > Fixes: 719f82d3987a ("ALSA: Add support of AudioScience ASI boards") > Signed-off-by: Tom Rix Thanks, applied. Takashi