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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FDDCC25B78 for ; Tue, 4 Jun 2024 18:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=eUCGs8/Y0JqgKTLac5SnPyDIplVF+tcYHb+hE21291k=; b=wOb zIxZSAnZZuuU7VxBvi/jm0l0JQzIPC0nUGDHOUniGFgYuxtOjGhc+1ZhuZe20OkMIbKI4KMKGDJYG nGlV7UwtqpvpJv6soGvKpHy02JB0yFkfavKJA8GwNHuMWntN5NxvV2h9zDCQGxaXhjeugBnfZOTym d5fZ2lLX8p7OVw/pX7LswxVURMqSdkfDMmuWTycmuclK/s/CD6Prfs91v/wwdtYUtFnYdWWsdG4xC rsjEodJ+oU7krLSHYZNh/SCe2sL+eMBlW92z/u7S37Vc0/Btye3EPO0gxZbHo/zDZNeBiLU+Pz74s uk0UZsg+KSEBKtfhWumK8/I/hZmmZDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEZGp-00000003V1f-1QfL; Tue, 04 Jun 2024 18:52:31 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEZGm-00000003UyV-2lzA for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 18:52:30 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-62a1e9807c0so1977757b3.0 for ; Tue, 04 Jun 2024 11:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717527142; x=1718131942; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=QinZc84Ac+qY0luma+PGFDFARquLnMN+4RLVb93myYU=; b=LeAl+BPUvurZuka7LFEl3mBUPXwe8EVZaoTej0ES+x+2DQvhAjHWn3oOcqpnv3NM8P WnVQ1sBZS8BS5Nmh46J4MpGL321YMSlv3974HroB9U8vwg0UMiaxaIjN9++ygY9Dadbr VZk/bLch6cqvPJ3a5QiDH+yF1is3cVIul0AaSL0ZfjUMtpFvsk0MyEM83GCE4JY4BL40 Dp8rHtkNkvoSBmDU5QENGl+qhcFuxQIlFQW2cp/VAF9VsXUfIL85AOQRwZG6sT7B1uWm BuxW1D8JzJyslXuQpvrRN3U/stJqxls6o47nUC5tZuFY8xRnkcEhj1P4QRtMrJ92j51R 37DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717527142; x=1718131942; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QinZc84Ac+qY0luma+PGFDFARquLnMN+4RLVb93myYU=; b=ZeAt/f0cAXtXX13vItBWCWruYs1rZ8SlzHVu6LKX2UFqB5hkQ28vV3QEwaDMQv3F5Z 81JCpZCkrjd7i3tPIDc03M8HeRX5gtFvjD3DU8Wszst/+GtlQZpb/sKhEPF+3IA+SLP/ 6l7h/1WWGkadyCljFHQpJIzKe01qwf7xSKV2FVj33aKbZ4DBozoOayxHBzjkUvAWW3eu yunr3eYBJA2i//1Aob0FuwZ3fQBI0PljUZSIRzBW4uu5jauKWaUmYQ/wtm5tV6ygNdyl +cgZNYgrvYiY8MeaUh0AjWVNoJvuwaRAkMKLh739qTWkdA8DuskREY9b0paDYq+t45CG //nA== X-Forwarded-Encrypted: i=1; AJvYcCUkajjVi+fcudXDCJ0EShtMUGkfD/cd/qvtuhEqxgS+BXfmSQxbvOqqc8yUMMG24qiWPWJtsJQd0qFxH/rHg/X/LdWxdpY7ybmVvI88NhVZA1oYWrg= X-Gm-Message-State: AOJu0Ywgqfhid1bZVQooBhX1h70pmM5w3sJ0SQeyCg2SQvSUQJca0N/y t4oyFeyRtsVdZxR5Gx/G2PHrblOYJR42j41AiYzyqLF4tQEPG6aZbCg1Y+X3l/ITRseKHPIv+nS cpdyD8Lho5A== X-Google-Smtp-Source: AGHT+IFBDAGlNKpuJe3KrEo6TBkztIdrl3oKDL7VgzxoduDyeuFK/R22rAhIGO60kwUm3nKcI1m8ohqSfRf3gg== X-Received: from mostafa.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:333c]) (user=smostafa job=sendgmr) by 2002:a81:4014:0:b0:627:de82:8077 with SMTP id 00721157ae682-62cabc78cd1mr7092087b3.2.1717527141788; Tue, 04 Jun 2024 11:52:21 -0700 (PDT) Date: Tue, 4 Jun 2024 18:52:18 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <20240604185218.2602058-1-smostafa@google.com> Subject: [PATCH] iommu/arm-smmu-v3: Avoid uninitialized asid in case of error From: Mostafa Saleh To: will@kernel.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev Cc: linux-kernel@vger.kernel.org, joro@8bytes.org, jgg@nvidia.com, nicolinc@nvidia.com, mshavit@google.com, Mostafa Saleh , Dan Carpenter X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_115228_752152_0E5477AB X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Static checker is complaining about the ASID possibly set uninitialized. This only happens in case of error and this value would be ignored anyway. A simple fix would be just to initialize the local variable to zero, this path will only be reached on the first attach to a domain where the CD is already initialized to zero. This avoids having to bloat the function with an error path. Reported-by: Dan Carpenter Closes:https://lore.kernel.org/linux-iommu/849e3d77-0a3c-43c4-878d-a0e061c8cd61@moroto.mountain/T/#u Signed-off-by: Mostafa Saleh --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index ab415e107054..f456bcf1890b 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2302,7 +2302,7 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_device *smmu, struct arm_smmu_domain *smmu_domain) { int ret; - u32 asid; + u32 asid = 0; struct arm_smmu_ctx_desc *cd = &smmu_domain->cd; refcount_set(&cd->refs, 1); -- 2.45.1.288.g0e0cd299f1-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel