Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5453673imb; Thu, 7 Mar 2019 16:29:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwHia68USdPR7Hj9a9UiWFNzZ41iaMwE8DXPXbbpWJjkvgOjmMUWip+i+86IwGkKtits0lJ X-Received: by 2002:a63:68ca:: with SMTP id d193mr13894850pgc.53.1552004976546; Thu, 07 Mar 2019 16:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552004976; cv=none; d=google.com; s=arc-20160816; b=pb3LBtANqZ5OoozLIivGY7pYBakKCndJ7Z+CkPxZvTHm8uiJH4YohZ9j2rq2dlTD5U H2Dqxjnxhfc/Ap9/IdbGx99n0aE6KG9p2Y/+bACOzrYr3NmDB9jPAuJRyZdp3MSo0Xum /Zz4FdghP3mohDjiwGBx8fPKqrsGHoQbA4pTKkDDpqISs2x1WB2T+qnkme2p4r0xVTGk V3A4I4auL7RpqC/wCE1nDpVywR2sItiSuMYYDrFlKo4v1fDmoWPIY7Zegdd+lYmBNwZq YjEW/o4+wmrTmx/sPuSXCZz3SGUlwa4w+vrJ84BBd9XH3qZi7aMrgXYHS1L+uasy+kBS jW5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5aMcC2e3BRQ8MRf8jt7V0HNINMgwvCC+sL+z9DPUXa0=; b=S7rrYRIAn7DtO+VdRJt/myUNL2m+c5D9/FtGxrMeaQg+SiYXNCW7DiW0XmZfahztwY f2eyMLk2DcxuT044PmONNtT9A+kO8/9IsfoDrzFWc+m0Wj/Gq1SO/KcC0yxGxNFkZave 5XzrncLeYWa1klQH+iDhkvGlztbMels4fNopJnWH6zLNHeo3sduRQ0bPBb00ti9EKJ5v BsefBX4Un+M9w+TTAWyHL9WQSyGSCGVu4PmRpGAx5RasaR4sV5UiHfc25tDBnrYT//iv 1E9+cKleLjoLrJP09AxfqxkAM0AVSjovSA6Iyog8DnTovvambJUEipfKxWh0JtthgEGq QZbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AdjE0Jhe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si5614123plh.397.2019.03.07.16.29.21; Thu, 07 Mar 2019 16:29:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AdjE0Jhe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726357AbfCHA20 (ORCPT + 99 others); Thu, 7 Mar 2019 19:28:26 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35206 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726249AbfCHA2Z (ORCPT ); Thu, 7 Mar 2019 19:28:25 -0500 Received: by mail-pf1-f194.google.com with SMTP id j5so12758133pfa.2 for ; Thu, 07 Mar 2019 16:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5aMcC2e3BRQ8MRf8jt7V0HNINMgwvCC+sL+z9DPUXa0=; b=AdjE0Jhe/W8RMuzX16dGstwkm5owLC3kBObuSKcmTNAKrznDmH9HvVUiQhOQmhBQC/ tfM6bEnZKO5tAv7X3HtrvHvW6FtdMbGGT2LzHor94c/9FysgbEU2Sz+V6kkQijaDR5ER yXbSfczGGPSieziqaCgFUuZQhkgKWjnLpDXx2l4U9wQ+kVaf3ciiH0Asj58mOMb5lBvA 1CPzjh2K3BHJXB6D2DBwRaqj+NTrt2n00CKGHXilOz5G7i4DDi0l0vJFpkdK9rkaf5BC 01OI/EO42I42hzzlqgydH10w5Rei5pUUuipOD3+LEF4QQyGBvx+YMv9PaEiHlgjKqm3p zytA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5aMcC2e3BRQ8MRf8jt7V0HNINMgwvCC+sL+z9DPUXa0=; b=oBvetzOw26LSjc05UxxFBdQReUgKFBMZVsX2C+UriTAo1oBr2w1LDUglvNRCiTTh9j +A3gH1pf04OqNPvC3k3rABqNcHL7GwP1s/SAt8+2e8/j7IRZBvWYVgvTjZaw2+4hXjKx XzfPXVnf9RBc+87bCGbFBccRfaZfYzYRAKIJ3Ubz3IWHX2zijkdn9U4W2wW8aUVxWp4H OeGdLr0GPoGiV0YqXwtOWbMRqGzxn+9l3HbRwAfZvyY/0EIJY+NnHbIJOwrnoWIAYV9W 8lHbDrAqzDbrOh9Yv380y2tw0KuQQDI2nq6VLyy1iDW+PYfKgTUbWxc9jVtp+HU1n/oO KnqA== X-Gm-Message-State: APjAAAUiRdGo/iS4krlR8tnqoPyXur3VcMdq1ZiKFplvMeomvjpo9aHm IXgA3P+GqQZ33LR82tEwl1+I/07QyCTW2ECfwKm3YA== X-Received: by 2002:a17:902:56a:: with SMTP id 97mr15649767plf.320.1552004904690; Thu, 07 Mar 2019 16:28:24 -0800 (PST) MIME-Version: 1.0 References: <20190307222611.18100-1-natechancellor@gmail.com> In-Reply-To: <20190307222611.18100-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Thu, 7 Mar 2019 16:28:13 -0800 Message-ID: Subject: Re: [PATCH] drm/vmwgfx: Zero initialize handle in vmw_execbuf_process To: Nathan Chancellor Cc: VMware Graphics , Thomas Hellstrom , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, LKML , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 7, 2019 at 2:26 PM Nathan Chancellor wrote: > > When building with -Wsometimes-uninitialized, Clang warns: > > drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:3964:7: warning: variable > 'handle' is used uninitialized whenever '?:' condition is false > [-Wsometimes-uninitialized] > > It's not wrong; however, in practice, this is never an issue because > the value of handle isn't used when user_fence_rep is NULL because > vmw_execbuf_copy_fence_user returns immediately when that is the case. Still, it's better not to conditionally pass unitialized memory to functions. Invariants like "don't touch this possibly unitialized memory in THIS case" don't always pass from maintainer to maintainer. Thanks for the patch. Reviewed-by: Nick Desaulniers > Just zero initialize this variable so that Clang no longer warns. > > Link: https://github.com/ClangBuiltLinux/linux/issues/397 > Signed-off-by: Nathan Chancellor > --- > drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > index 88b8178d4687..4ba06c2828a1 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > @@ -3829,7 +3829,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, > struct vmw_sw_context *sw_context = &dev_priv->ctx; > struct vmw_fence_obj *fence = NULL; > struct vmw_cmdbuf_header *header; > - uint32_t handle; > + uint32_t handle = 0; > int ret; > int32_t out_fence_fd = -1; > struct sync_file *sync_file = NULL; > -- > 2.21.0 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To post to this group, send email to clang-built-linux@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190307222611.18100-1-natechancellor%40gmail.com. > For more options, visit https://groups.google.com/d/optout. -- Thanks, ~Nick Desaulniers