Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp275316pxb; Wed, 25 Aug 2021 03:01:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM+QhG7zQ6GHr6furQiS3PBRLJfZS7qlZnYwdL8e0RwekxrRDbtF3MOsTzwMWF31nZU913 X-Received: by 2002:a17:906:a0c9:: with SMTP id bh9mr13364101ejb.51.1629885673332; Wed, 25 Aug 2021 03:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629885673; cv=none; d=google.com; s=arc-20160816; b=EqYu2k8T6odqxiigmspBrOO5N2NUJU7xUEQ2GVmzBKQ851CwGlidnSSSkD//LOMpAe THIytZ98aykWaxLiLiV995HT0Gz3VJmXfoivJ2QbjHY+Bk9XHZh7lp3myNWZdYNIYLj5 xUpqiUWH2CVS2Cyy5ZfKDBe3rMdD4suzqou4HITX5o3yMdvSzPHj2Sy+yBSqyO51iJdx i4QwGCoypfmGByfUff3q4M0vFaBT+VWB3y1YAlHUVGCrpn2jUcSO1pzWPUMwALkN8/Nv oIp01C4VNtjc+VUA8IVaJNH19h4NBzieuSBf/LsyOjPPHtgL/yUTropIHqGdNwRlrfXE bYiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=wYiFbeJ+yLSY4/oob1FvSTqnc3agZyTo2y+6pLWNjd4=; b=M+OvnBTuKbW2dKBx8POjvKTyLfxhYnufObdPH+HK85li8IPBZOUJtyfgOkysYwkhvC Ok9HZAW69ejln6PcqEmTiZ8Y7xQs1/gZsAwpSYU8wj5gw93ESk4heydDTzhFEEm721mL WP4tlYva3IdHj+Ai0LF+MeJbuu6hApv0gSo2BJbQ3ISa5g7S4dp1xroNccxDaLE53aC1 dV8IuYVXliHMCLk3YkNU1seBvFDbpl6ClVJW95WWzpojpGCAFkDCbOCPp2CcJhlIpuGf Nqr69o4f9stnQfQtI4cnryHQv41IK0RihGZs/p+mvdy7R19cn9UryKd/dnjN9EtnCwpb nIeA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk14si19396287ejb.220.2021.08.25.03.00.45; Wed, 25 Aug 2021 03:01:13 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239219AbhHYJ51 (ORCPT + 99 others); Wed, 25 Aug 2021 05:57:27 -0400 Received: from mga09.intel.com ([134.134.136.24]:19636 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234372AbhHYJ50 (ORCPT ); Wed, 25 Aug 2021 05:57:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="217495633" X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="217495633" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 02:56:41 -0700 X-IronPort-AV: E=Sophos;i="5.84,350,1620716400"; d="scan'208";a="426393046" Received: from pjthomps-mobl1.ger.corp.intel.com (HELO [10.249.254.76]) ([10.249.254.76]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2021 02:56:37 -0700 Subject: Re: [PATCH 1/3] drm/i915/selftests: Do not use import_obj uninitialized To: Nathan Chancellor , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi Cc: Jason Ekstrand , Matthew Auld , "Michael J. Ruhl" , Nick Desaulniers , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, llvm@lists.linux.dev, Dan Carpenter References: <20210824225427.2065517-1-nathan@kernel.org> <20210824225427.2065517-2-nathan@kernel.org> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= Message-ID: Date: Wed, 25 Aug 2021 11:56:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210824225427.2065517-2-nathan@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/25/21 12:54 AM, Nathan Chancellor wrote: > Clang warns a couple of times: > > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:6: warning: > variable 'import_obj' is used uninitialized whenever 'if' condition is > true [-Wsometimes-uninitialized] > if (import != &obj->base) { > ^~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:80:22: note: > uninitialized use occurs here > i915_gem_object_put(import_obj); > ^~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:2: note: remove > the 'if' if its condition is always false > if (import != &obj->base) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:38:46: note: > initialize the variable 'import_obj' to silence this warning > struct drm_i915_gem_object *obj, *import_obj; > ^ > = NULL > > Shuffle the import_obj initialization above these if statements so that > it is not used uninitialized. > > Fixes: d7b2cb380b3a ("drm/i915/gem: Correct the locking and pin pattern for dma-buf (v8)") > Reported-by: Dan Carpenter > Signed-off-by: Nathan Chancellor Patch looks good to me. Reviewed-by: Thomas Hellström