Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4914874rdb; Fri, 15 Sep 2023 17:05:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGTCvnVZx7Pp24HYuFuqf3duh2gEF2r9o0NPYuXotrqH8U/Di/LcKXkSS+s4ueC4dR9k8g X-Received: by 2002:a05:6a00:230b:b0:682:4ef7:9b0b with SMTP id h11-20020a056a00230b00b006824ef79b0bmr3906978pfh.0.1694822738282; Fri, 15 Sep 2023 17:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694822738; cv=none; d=google.com; s=arc-20160816; b=dsuTF+U0yF3XrPDVJSUDo25SYB/UqY4XfMZONIZeW4L7qi0LVcJP2G9MMfxvP39gvv eLcAPML+wIimiQSHsXABea7CF+ainehZ5iv4BVB8DB8+5z5Lr0sc7vGGk5L/eohrAKOV sA80seTSh5FWbpyiGsw8AefNQzcqMmXDLvnFD4ESmala8yDzF1v1EOHeVvxkPiPfx3ap pS2nYdmk65tm1dPVREtErCdSTH7ybNgKvpWMLxu6gs2JKZDGF0VU0/aBnhM18dPpFsVh MkpNgvGxJJEmJKldW5ED9xQ5fTf7kIo02cQ54YjT1qpKkdEqvzU4OebAD++L/vJWdZHU VUkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=FydRHNuSiU9lI0l5Le9Lmmb62FGr7xwRau34f1XeHkA=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=TiQ2AgOPdq56/5p4L8FJQ7NcC6cSWZNI3V41wuTDauOCgc2tThcDy0q0eYqg5gyuZw FXB4y69eyR+pHltReVWW2669X7VZOm5IcqKHU+jzQ0ddtM+qtnRmSSwcFCLCa2OSbdQP NvG7diS6a7osyw8OLtIKjM834RIeVPcp+WMQL/m4ysOw3MN3NlTcCzjdfpes/sMfzeWk EuECpdiIcgDFp6aD3QocJJuDxOGvx/obYd/DVRcAVCgWMPaw6v2iX10nLV/L264G9LZA P5G5bdhDyxKgDnzSDFZMAjQZX5huWu3SswF1OpxhEjyfKb88IAK0h9y8heCsOZytjeNe vJZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=He+8fYpk; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h22-20020a056a00171600b0068a3a7f88f9si3999869pfc.128.2023.09.15.17.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 17:05:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=He+8fYpk; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1EB278071215; Fri, 15 Sep 2023 16:48:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236647AbjIOXr5 (ORCPT + 99 others); Fri, 15 Sep 2023 19:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235142AbjIOXrv (ORCPT ); Fri, 15 Sep 2023 19:47:51 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 453B82119 for ; Fri, 15 Sep 2023 16:47:46 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-68a3ced3ec6so2480283b3a.1 for ; Fri, 15 Sep 2023 16:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694821665; x=1695426465; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=FydRHNuSiU9lI0l5Le9Lmmb62FGr7xwRau34f1XeHkA=; b=He+8fYpkRIg97FEZlfDlYdxsMGqCLFzSUpLoqa/VUD7RMomQ4tHw1ndREKjGXUD9c+ BRXJHiXQ9zLbSKNUY8M0y/oH0GeqGVw/78YRtzU7dROwHUYeneyjvXcjE7ES1xoU6AKp d7A8U91GapLFTUpE1tfSDdjRlSV1kAranCRsRwLC9zzhMDkdNUhYiCam0N4dHkRe9DEp ZAbBEgToKbodWtHG3HbW9mj3VNAsK6XUuw00a1BFmma6Hc3J7zhx6XBYE1jIGXnX2jL8 F4rHsiYzjuIBdVJySrLrrLTiTY4eWMXA7aXKM8SQAIgV+oaNqkjd2pdn0xPjCbh0xtIM eG2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694821665; x=1695426465; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FydRHNuSiU9lI0l5Le9Lmmb62FGr7xwRau34f1XeHkA=; b=pakLS5LF3Mfh3JuUFNzXQycc/+xAyIQggN6iRLRqlfeMvgU1BImVgxz2k0uANDGwz2 /WBB7sxAb6mTV86Yzwe5MiBD8xhMd0Sb/Rho8T2ygDyH/I7BPFFiEqMKGI1QhAehhVBw Hf7aAde2MsOYYE2N6QnPLFlIEzj2PklL9byLRb0ebyd6d6f6aQqmQePS/Oau04TnKBNM Y27sT4CSUgtqxBHszyIeabYbMPvUMk6nY156KN2L27K9rq/Rrn4tJZNs+YzzfA6/zPgo z2A05l71VSHHB0Y1zijW9a2gh6BAsNi2/Cm68EoDv63Dta1Wt7sRk1ghY+Je/4obyWKb RiLg== X-Gm-Message-State: AOJu0Yw2TZiCAroHZzThzm2sepj73AzukYo/jhkk/O7XwgBLdoDVUGPL TIT/C7YpcopfbYc1fatZr+z2FY1QxRk= X-Received: by 2002:a05:6a00:150e:b0:68a:5449:7436 with SMTP id q14-20020a056a00150e00b0068a54497436mr3460242pfu.32.1694821664983; Fri, 15 Sep 2023 16:47:44 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id k22-20020aa790d6000000b0068fdb59e9d6sm3438129pfk.78.2023.09.15.16.47.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 16:47:44 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 1/2] Bluetooth: hci_core: Fix build warnings Date: Fri, 15 Sep 2023 16:47:41 -0700 Message-ID: <20230915234742.3739283-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 16:48:28 -0700 (PDT) From: Luiz Augusto von Dentz This fixes the following warnings: net/bluetooth/hci_core.c: In function ‘hci_register_dev’: net/bluetooth/hci_core.c:2620:54: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=] 2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); | ^~ net/bluetooth/hci_core.c:2620:50: note: directive argument in the range [0, 2147483647] 2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); | ^~~~~~~ net/bluetooth/hci_core.c:2620:9: note: ‘snprintf’ output between 5 and 14 bytes into a destination of size 8 2620 | snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/hci_core.h | 2 +- net/bluetooth/hci_core.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index bbad301f5781..f36c1fd5d64e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -350,7 +350,7 @@ struct hci_dev { struct list_head list; struct mutex lock; - char name[8]; + const char *name; unsigned long flags; __u16 id; __u8 bus; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index db4f28d68d71..9e89843c259b 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2617,7 +2617,11 @@ int hci_register_dev(struct hci_dev *hdev) if (id < 0) return id; - snprintf(hdev->name, sizeof(hdev->name), "hci%d", id); + error = dev_set_name(&hdev->dev, "hci%u", id); + if (error) + return error; + + hdev->name = dev_name(&hdev->dev); hdev->id = id; BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); @@ -2639,8 +2643,6 @@ int hci_register_dev(struct hci_dev *hdev) if (!IS_ERR_OR_NULL(bt_debugfs)) hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); - dev_set_name(&hdev->dev, "%s", hdev->name); - error = device_add(&hdev->dev); if (error < 0) goto err_wqueue; -- 2.41.0