Message ID | 20230804-uninit-fixes-v1-1-a60772c04db5@ideasonboard.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp236834vqb; Fri, 4 Aug 2023 05:48:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjQDqlA+JStBrjZTz+s7SR4CTeOBrZ9SduC9lveIzDNHoBCi24OeM0a3OjZyo1X7XH4pXm X-Received: by 2002:a50:fa89:0:b0:522:3ad4:9c9c with SMTP id w9-20020a50fa89000000b005223ad49c9cmr1384582edr.31.1691153329213; Fri, 04 Aug 2023 05:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691153329; cv=none; d=google.com; s=arc-20160816; b=Hp2oDp0/Kkuq3oXjWq4vvctJrFDhMb2Ksg9AzNYMkArvO6/9DhsuaVyeSmegxESZgW h1V3YQP9NlZtmAGwIvjMlkfBPfNgjd3k31ESj4muDZLPY54WST/vieRARLFWX/kMtkms 2P9QqJGoxjKN7oKsyAJQGc2BrbV0UOhTzRWzS4s+texGuzADbVPB1o+p0b5aI35/3G4/ z9q/VEVQDMlfoqF9FM9uZKPvWaE9Acj01PsAHN8XvHIgYaGeBGjPr4eSCyzIf4BbaVge p24GS+WmULA7x1JHdPqaOWIlGwogbuS4be4IT9Cl9Eja1W45PFw33OFkgCSHMZgW7wBv 9Keg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=G4hcMQqreiuxIkRdvZiUv+q8xDkrKBy9U1VMnZYJ8LA=; fh=mKB0MiebSSgCwrUmRpmOO4CKMRKmrOm2ubh9mnTvofE=; b=OzQitQckihyssc6GNMHBQ1e6npLSJfKW20ZMUR12xZVIkYDJPmFbZiXn252yLzyD3C fyhGqFO25TUHEDUWPXFjncakI536w6yP8Fs+C/pM4NTktMw0kuoinY42oP1/zPEXn9bc SC5oQSyfRA2KGVmZUFsyPGsBbeB7Qd3SIgkTQjGPkumJukfETqSjXaQiP0lUTQbnF1Dd Og7Xaa1Ej/pBDafumkCm3HUqtQ8fIuxUZYD59DHHDl/GIdBZx+yLZoQstogVixE3XCDc tso1Cc5q/ZhFTI46GYejxeMWq7F7Rbk/awEyN0F9H/tAce/qI/eqFOO1lGOZzWAN6tfv tElQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=AKn77msn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a056402151200b005222c51fac1si1559591edw.659.2023.08.04.05.48.25; Fri, 04 Aug 2023 05:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=AKn77msn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbjHDK7y (ORCPT <rfc822;sukrut.bellary@gmail.com> + 99 others); Fri, 4 Aug 2023 06:59:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbjHDK71 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Aug 2023 06:59:27 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72FA198C for <linux-kernel@vger.kernel.org>; Fri, 4 Aug 2023 03:57:56 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C3CBA12E4; Fri, 4 Aug 2023 12:56:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1691146610; bh=VTa2EburIeC7ChqorcZc2l1A1SMNu4ojq6nMgbI61lo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AKn77msnpIlD0Kk6tKgFEdJoRb15t1vRLnKPfJ5vmmpIXUJyDAPJTIqAZV1wzA9Qh fcClpWeiOvsrxIXd7QlWI8PJBk6JBzViFy9P51ChDyZvhSequ6LWLZhLj7sP6o51V8 zUux3gI6my0VJP6M+fXmXbU8kY5fF1PszC5u3cc8= From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Date: Fri, 04 Aug 2023 13:57:39 +0300 Subject: [PATCH 1/2] drm/drm_file: fix use of uninitialized variable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230804-uninit-fixes-v1-1-a60772c04db5@ideasonboard.com> References: <20230804-uninit-fixes-v1-0-a60772c04db5@ideasonboard.com> In-Reply-To: <20230804-uninit-fixes-v1-0-a60772c04db5@ideasonboard.com> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Francesco Dolcini <francesco.dolcini@toradex.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1073; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=VTa2EburIeC7ChqorcZc2l1A1SMNu4ojq6nMgbI61lo=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkzNmwdMlu13HRR98mkzzHgHB0EiqVgIVKqSq7s clqaDQDXVWJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMzZsAAKCRD6PaqMvJYe 9fTAEACZDQ+ZDxBGR8CbKBIYz1KuqsVqKDRqlKhnuxPO0kt3B/gE1u73OlhZUlEkf2ahK1wzTj0 QiYUNhfSdSaQQZvqQpvsBuoisn3reW+j5rYdZ6jz58Q405tB0/do46Zlkx0MT4fW8o1FrJUcVGU ZEtBbJ/0RDfQkA4Pxc/U9ivBRZEWmrVY1rSGbtsSfh04hiDzPEL+oJT5dQgLHJqLPXDrOLvMy/j 8mjgAsAN/PcBw+SnEBRyA06JRGwNMMEMSxL/dUHaLqXiAmzeQgQIpRdtVHAgYkyYbSppWV12wmh 6K+TSMo+akuRlP1ZBQczvsMP+pBibQ+ORc/Gyja+AqI5cnhz3hGgMLsR3QqqWmsWjYUa+/TDFOi M3xGvfS0kxam1Q6dawd0CpPUX7ZuN9Na72Tc+UDOmS7SScskLOV8PEet5hGMoQkiPes5ouh3Fwx /7XXcahbPiPr3mqz70V3kdeSAQQTV75fLPKJ5qg3E1GEd0NT49qeoSPtLS5y63h/u78iw2kJjI4 x3nZ27xIFqlXaa6mX9SEypsWS7n3KUVEOCo0MKPZRet/Vx0NckQg5l4QxYuiQ120R006oAtdSrx MM9dVaKokccfbCf9HUoCK3C0w9Ynj+awarH4WhCJszXBkEBl08afzJ2YohwwxvwDxOLx/5wu16x ZdBMGhqrsxPq6QA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773302793544260770 X-GMAIL-MSGID: 1773302793544260770 |
Series |
drm: Fix errors about uninitialized variables
|
|
Commit Message
Tomi Valkeinen
Aug. 4, 2023, 10:57 a.m. UTC
smatch reports:
drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
'supported_status' is only set in one code path. I'm not familiar with
the code to say if that path will always be ran in real life, but
whether that is the case or not, I think it is good to initialize
'supported_status' to 0 to silence the warning (and possibly fix a bug).
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/drm_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, Aug 04, 2023 at 01:57:39PM +0300, Tomi Valkeinen wrote: > smatch reports: > > drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'. > > 'supported_status' is only set in one code path. I'm not familiar with > the code to say if that path will always be ran in real life, but > whether that is the case or not, I think it is good to initialize > 'supported_status' to 0 to silence the warning (and possibly fix a bug). > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > drivers/gpu/drm/drm_file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c > index 883d83bc0e3d..cc06e1836bf5 100644 > --- a/drivers/gpu/drm/drm_file.c > +++ b/drivers/gpu/drm/drm_file.c > @@ -924,7 +924,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) > { > struct drm_gem_object *obj; > struct drm_memory_stats status = {}; > - enum drm_gem_object_status supported_status; > + enum drm_gem_object_status supported_status = 0; > int id; > > spin_lock(&file->table_lock); >
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 883d83bc0e3d..cc06e1836bf5 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -924,7 +924,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) { struct drm_gem_object *obj; struct drm_memory_stats status = {}; - enum drm_gem_object_status supported_status; + enum drm_gem_object_status supported_status = 0; int id; spin_lock(&file->table_lock);