Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp151782lqo; Thu, 16 May 2024 02:04:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSEEcB/umKTwUIrCJcuCidkImAXcu3GgeIe65ZH/VIqIhIwNqZpVorwVlv/zWbujWBh1K5izO31WWQvkqZjt9UX0Y8bjWiyCffFpWSWw== X-Google-Smtp-Source: AGHT+IEmCOR1Mnk9vgOm/Rd1nUMU7KmphzqYBqw9UgWxUtWAUpJIo5wQegyCZQQ9uPw278OL6RNg X-Received: by 2002:aca:2316:0:b0:3c9:7825:1feb with SMTP id 5614622812f47-3c997054ad2mr19120851b6e.17.1715850260004; Thu, 16 May 2024 02:04:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715850259; cv=pass; d=google.com; s=arc-20160816; b=h0wuWvYc4kNcPAk2ZOO88719VpL3pu5a8EzzO3+sHm4yAVSw7J41pkQfvh7mlq7cnr Go/8JpYckQKp00qBg9uDySGz0etdvDj7CFh+eqBgJJx86cW1Jqy0agMlnXuPhO1twWg2 qv2tp68VU70aUlk4/8C8Dh/Legc7VmvjxVQtmIaH/V2n8M0DKcSVXnoNYp7WNAPP5nIG ZYTndWzsP5VzRZ8q8/h2Ao0nrc0w8SQOMFngPpbCh5Tt6sxOkXR+VKx/B2vZ1zDzTRxs 8LekM5fVxsIQ9gVoEw4+aqm5XL1lgcUHmYJ8j51+tvpp/YOi/4V00RGlgpRXfQKlOETK ejvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ONOWGXnbOMizPaVTfcO6qHkE11JdLAR1FF3w2KNiqy8=; fh=uo5u2TQK/HQlhydMwGLjBAnuDwaLxndJ/cgWTjIagS8=; b=v5vJhYVe/OSFjUfNgEDoVNaCVPjS/PDpy9xKX0+y4o0PIaNsD+A3tPI2BXugMlrxmh /HTjhVop45o9lhNWrmQDFdPqZSb0rPI75U2WG8OW0iT8LbAJLCWJpzR8lsBrr72NhFh1 3vLJn0zsqRzOhIKmm7oF0tymdISy5gTITh55sN0I7wx+uN60PcVMfoR8vpK3gpRTsulF BfNisND4K+hQE0jx1LEu6NBmSJxZpoLV11XJVTGcCh2/Cts9V+Wfc4VJlGUGTdnroveo BkmJsKKsjHjHF0dx4NiAAhp8WSIF+C0wqsyXyCnqm7mSaRYXdjEjNAbyXA7ZoKsRt3wR /KZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4693-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4693-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792c366fe31si1622337585a.292.2024.05.16.02.04.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 02:04:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4693-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4693-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4693-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B297A1C21533 for ; Thu, 16 May 2024 09:04:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55C42143755; Thu, 16 May 2024 09:03:51 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 327CD142912 for ; Thu, 16 May 2024 09:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715850231; cv=none; b=KyXekzDzHAPQJEvVbbGJZhXmmd4wBXjxoeTHYqwyKBGnG1gLgg06U7KJLON2trWd18NYV6wEdWf/agDsrXWMukf/sk+YfCqgMJTmXINg7kY3JNwPLyponaFtwld4j0W+6SNnn2fwct8OUUGmRCenU+84Mrh4ThQrdi49D06KGB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715850231; c=relaxed/simple; bh=KoK9Uxs4odh+a3x9TyxMTRK8Zm7JWwsNCXZajcs4rZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iVMwm9OcHHIqjTrKnD/0NQB+zyDfo9nTNq2kiBqxdJiJtkLuJS4N2WHqnaY0tIKee4RSyRNJEdlHJz1UUvLBnbly04HDkrai9GWQRllOQxQh5IbqhDsFmxi3Y9Dyfuqxcka7uAYgTBnO/RvMrlZOSfzntJHetx+6c0sXLF6JciY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net; spf=pass smtp.mailfrom=hadess.net; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hadess.net Received: by mail.gandi.net (Postfix) with ESMTPSA id 2F63F1C0014; Thu, 16 May 2024 09:03:42 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Cc: Bastien Nocera Subject: [BlueZ 04/15] tools/mesh-cfgclient: Fix uninitialised variable usage Date: Thu, 16 May 2024 11:03:08 +0200 Message-ID: <20240516090340.61417-5-hadess@hadess.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240516090340.61417-1-hadess@hadess.net> References: <20240516090340.61417-1-hadess@hadess.net> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: hadess@hadess.net Error: UNINIT (CWE-457): [#def64] [important] bluez-5.75/tools/mesh-cfgclient.c:1992:2: var_decl: Declaring variable "result" without initializer. bluez-5.75/tools/mesh-cfgclient.c:2041:3: uninit_use: Using uninitialized value "result". Field "result.last_seen" is uninitialized. 2039| l_queue_length(devices) + 1); 2040| dev = l_malloc(sizeof(struct unprov_device)); 2041|-> *dev = result; 2042| 2043| } else if (dev->rssi < result.rssi) Error: UNINIT (CWE-457): [#def65] [important] bluez-5.75/tools/mesh-cfgclient.c:1992:2: var_decl: Declaring variable "result" without initializer. bluez-5.75/tools/mesh-cfgclient.c:2044:3: uninit_use: Using uninitialized value "result". Field "result.last_seen" is uninitialized. 2042| 2043| } else if (dev->rssi < result.rssi) 2044|-> *dev = result; 2045| 2046| dev->last_seen = time(NULL); --- tools/mesh-cfgclient.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c index 6d2d34409fe3..e39f145c6241 100644 --- a/tools/mesh-cfgclient.c +++ b/tools/mesh-cfgclient.c @@ -2021,6 +2021,7 @@ static struct l_dbus_message *scan_result_call(struct l_dbus *dbus, result.server = server; result.rssi = rssi; result.id = 0; + result.last_seen = time(NULL); if (n > 16 && n <= 18) result.oob_info = l_get_be16(prov_data + 16); @@ -2043,8 +2044,6 @@ static struct l_dbus_message *scan_result_call(struct l_dbus *dbus, } else if (dev->rssi < result.rssi) *dev = result; - dev->last_seen = time(NULL); - l_queue_insert(devices, dev, sort_rssi, NULL); done: -- 2.44.0