From patchwork Fri Aug 4 10:57:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13341682 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 2A4E2C00528 for ; Fri, 4 Aug 2023 10:58:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D764210E034; Fri, 4 Aug 2023 10:58:00 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7413210E02A for ; Fri, 4 Aug 2023 10:57:56 +0000 (UTC) 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 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 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 , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurent Pinchart , Francesco Dolcini 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Laurent Pinchart --- 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); From patchwork Fri Aug 4 10:57:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13341683 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 1BBE4C001DB for ; Fri, 4 Aug 2023 10:58:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8560010E17F; Fri, 4 Aug 2023 10:58:02 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12AE110E034 for ; Fri, 4 Aug 2023 10:57:57 +0000 (UTC) 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 98367188E; Fri, 4 Aug 2023 12:56:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1691146611; bh=W3BdCub5uZqFZ3mcZrRZT/MkOLhq4JHeGg/aXz3nw1I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kvA6fMuoRo1j5nIIY4k+dISbOKqRumEyxFPcz+9nvbehNM1KM9SImM79Ig82Hq3AX 5sAKvt/hhBS122FqZB0HFLI47vguOEqY/Tek6K4QzAefzo7dB8tnFeIfdnnPQFKeO+ UJuMHEubt+uRaeUixNSMOsFBmvDuokOJu51zPVC8= From: Tomi Valkeinen Date: Fri, 04 Aug 2023 13:57:40 +0300 Subject: [PATCH 2/2] drm/framebuffer: Fix use of uninitialized variable MIME-Version: 1.0 Message-Id: <20230804-uninit-fixes-v1-2-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 , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurent Pinchart , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=957; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=W3BdCub5uZqFZ3mcZrRZT/MkOLhq4JHeGg/aXz3nw1I=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkzNmxZWV22iZzrPJkJW6W5BD4iTDw0P5YJjzUk BzzN5se7uKJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMzZsQAKCRD6PaqMvJYe 9acCD/9Jqv5JDU5Yg3BWu883KU+wA96GtjuEePd9EJOMd/im3JTG77qMTGlkUQ07EIQ7l5/QzRw CQcyhXk3LYB5ocA3wWtTX0O5hvsT/k0/zVtur/wANTbncq7Ae+OoFBxYbdWwTbCkpYNW8lwlOc6 fv/9fgZ83E/NLAbdFTqyb1ER/x8si7NUKh7cHcm8Zjq2xPW01wKmsBLfl51XoYMOi+KaSvPajfg 74v1/shwTaOg/WapJlgBWgTISdJ9LnK2fFT/pNp16Y8KMBj1a40Tw+381Ne5zu21+IjNrOcfTF1 6LaNTK7kb5Bxugj8S2En42mUkACDUU6Gj0GrWEVqYD/ri6Q2GppTM48vjfKLhkKECkUJhKiHEby o8LbFZNMJG3auZHreOYO4pr/0xxwOXJ3GzvKRaykPD31h46dw7BLvHqU+J0If3LHYP51Hp1i228 J8knCsXJJu8XV+JBy9pzgpu9Dwj/67cbQY86+C/JZ4syDmqb1klTgbq+hDjR7kMfnytX9d0yl+S J472vWkDKGUksF06JVFHAq4QOnAlmv5JtuCqUZY0BVwkMoVXXPzlyVA/LlTeozb4lwih6EunGcb LVvmb/O/t2T6n7OqmQ/IcuUtxODVYWuatZeszSYFt/Td7DDXin5BFDfXKNF/EHzWhB0zkqWAEuE RvIi4bOlH9kqyUg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" smatch reports: drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'. 'ret' is possibly not set when there are no errors, causing the error above. I can't say if that ever happens in real-life, but in any case I think it is good to initialize 'ret' to 0. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/drm_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index aff3746dedfb..1955eaeba0ab 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -570,7 +570,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev, struct drm_mode_fb_cmd2 *r = data; struct drm_framebuffer *fb; unsigned int i; - int ret; + int ret = 0; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL;