From patchwork Fri Mar 1 23:16:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leon M. Busch-George" X-Patchwork-Id: 1906972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tSI6mvkH; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=georgemail.de header.i=@georgemail.de header.a=rsa-sha256 header.s=DKIM001 header.b=ffd1p1ov; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TmkZd6FVvz23q3 for ; Sat, 2 Mar 2024 10:19:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k8TzsjcD5Tzmifp+H1GKJCJVqjvGjd1il7HI2CLjK6E=; b=tSI6mvkHKMfrNv 3GNpai7L7hbfwYoI3auyf09kyvgt4ai8VV81KGK9ZmaJUO8m/nZYey+GFvYKGWQKJhRKg9Nc3KJ4x PwCXdJK5t2JBDQmL9w5gt57TiT79njTsVrLTHCjZ+JbEUJTbA/QqnjjekNcxQkVdNrRVBQtTypf2U ZCjP2p5/BStY91mZDGtuYhdbQcUORV8MYCVmjGcUBLFee2RM8Pi5/+satyQT3KNNsaypWwCOOAj6z uiYFyOs7B6Eco3lLxp+tDQDkm81de6PzfJJvpWIy3J49m3OFlZ8v90EtoTVwJphh5nSp5QNOBBLAj J0ox4FW9jcNyWT46O2lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgC8S-00000002Eia-0I4H; Fri, 01 Mar 2024 23:17:48 +0000 Received: from smtp5.goneo.de ([2001:1640:5::8:30] helo=smtp052.goneo.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgC8N-00000002Egm-3aWX for openwrt-devel@lists.openwrt.org; Fri, 01 Mar 2024 23:17:45 +0000 Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp5.goneo.de (Postfix) with ESMTPS id A2E3E2405D8; Sat, 2 Mar 2024 00:17:42 +0100 (CET) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id 1171E240A38; Sat, 2 Mar 2024 00:17:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=georgemail.de; s=DKIM001; t=1709335061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OeXDNG+xv7eJ6YgR4KopFT0lZRyF27XfS9wnEo1qVKw=; b=ffd1p1ovzUuekGQaTkBSIZ16zVUcTXilsqlZT1fCK5wFnlE6ofKjzvSjHFKMSNRznL9l8D yKqUumAxb+AyaonmZcoyycVEJKDqGYIqiKumbZ33OVI/JNvacZ/QUtEDeyDqd4PFmPov60 pkb/lCqOjZC+cOHGwa+cjcVnMsU6x5lfCu0kIWZ+24iUNfcuQ5c5DeIPo3KgVV8yi7yNFi DOcGzPKYs0DG1IsjnX5/fGncM+OWiqqkgM21BZ4ZYpqPD1Doa97p9/tNlZCdOYkSrkI7o8 HLoTjEQthanrb+QRLYwsFSD2SdQVH/boQyEHc0LNJAeZkhVJ1fM8GKGmpeQ7bQ== Received: from couch-potassium.fritz.box (unknown [IPv6:2a02:8071:5250:1240:f4e6:f6d2:6d95:e0c4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id CC95F24085E; Sat, 2 Mar 2024 00:17:40 +0100 (CET) From: "Leon M. Busch-George" To: openwrt-devel@lists.openwrt.org Cc: "Leon M. Busch-George" Subject: [PATCH 2/3] make phy name const to signify it's static nature Date: Sat, 2 Mar 2024 00:16:21 +0100 Message-ID: <20240301231721.139669-3-leon@georgemail.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240301231721.139669-1-leon@georgemail.de> References: <20240301231721.139669-1-leon@georgemail.de> MIME-Version: 1.0 X-Rspamd-UID: 944e0b X-Rspamd-UID: d90d42 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240301_151744_138300_95BAD1A3 X-CRM114-Status: GOOD ( 10.01 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: "Leon M. Busch-George" Typically, returning a char * signifies to callers that they own the buffer. Signed-off-by: Leon M. Busch-George --- iwinfo_nl80211.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2001:1640:5:0:0:0:8:30 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: "Leon M. Busch-George" Typically, returning a char * signifies to callers that they own the buffer. Signed-off-by: Leon M. Busch-George --- iwinfo_nl80211.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 2ea5925..8eab671 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -776,7 +776,7 @@ static int nl80211_phyname_cb(struct nl_msg *msg, void *arg) return NL_SKIP; } -static char * nl80211_ifname2phy(const char *ifname) +static const char * nl80211_ifname2phy(const char *ifname) { static char phy[PHY_NAME_BUFFER_SIZE] = { 0 }; @@ -788,7 +788,7 @@ static char * nl80211_ifname2phy(const char *ifname) return (phy[0] && !phy[sizeof(phy) - 1]) ? phy : NULL; } -static char * nl80211_phyidx2name(unsigned int idx) +static const char * nl80211_phyidx2name(unsigned int idx) { struct nl80211_msg_conveyor *cv; static char phy[PHY_NAME_BUFFER_SIZE] = { 0 }; @@ -907,7 +907,8 @@ static int nl80211_get_mode(const char *ifname, int *buf) static int __nl80211_hostapd_query(const char *ifname, ...) { va_list ap, ap_cur; - char *phy, *search, *dest, *key, *val, buf[128]; + const char *phy; + char *search, *dest, *key, *val, buf[128]; int len, mode, found = 0, match = 1; FILE *fp; @@ -1204,7 +1205,7 @@ static void nl80211_hostapd_hup(const char *ifname) { int fd, pid = 0; char buf[32]; - char *phy = nl80211_ifname2phy(ifname); + const char *phy = nl80211_ifname2phy(ifname); if (phy) { @@ -3486,7 +3487,8 @@ static int nl80211_get_mbssid_support(const char *ifname, int *buf) static int nl80211_hardware_id_from_fdt(struct iwinfo_hardware_id *id, const char *ifname) { - char *phy, path[PATH_MAX]; + const char *phy; + char path[PATH_MAX]; /* Try to determine the phy name from the given interface */ phy = nl80211_ifname2phy(ifname); @@ -3504,7 +3506,8 @@ static int nl80211_hardware_id_from_fdt(struct iwinfo_hardware_id *id, const cha static int nl80211_get_hardware_id(const char *ifname, char *buf) { struct iwinfo_hardware_id *id = (struct iwinfo_hardware_id *)buf; - char *phy, num[8], path[PATH_MAX]; + const char *phy; + char num[8], path[PATH_MAX]; int i; struct { const char *path; uint16_t *dest; } lookup[] = {