From patchwork Mon Aug 20 18:48:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 10570639 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48521921 for ; Mon, 20 Aug 2018 18:48:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 383592976E for ; Mon, 20 Aug 2018 18:48:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C4B729776; Mon, 20 Aug 2018 18:48:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_BLACK autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 911EF2976E for ; Mon, 20 Aug 2018 18:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726563AbeHTWFW (ORCPT ); Mon, 20 Aug 2018 18:05:22 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:46197 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbeHTWFW (ORCPT ); Mon, 20 Aug 2018 18:05:22 -0400 Received: by mail-oi0-f66.google.com with SMTP id y207-v6so27605412oie.13 for ; Mon, 20 Aug 2018 11:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=ta21b+MoGb5R21YGV2Bu7zBl0s7JQS2Y7To4G7tfKEs=; b=d+/OR9066M1X7p/59VYIk4uF+WQ3CscELc/3wOYlsOI7ubF+lgjzi3pawJ55VklYhf QyCb+RUzUvmzTmWq/9p6dOCzgnXA4lwCqLy4yOLBOHYIxF6MvQU8y/PWm1MstXYNWhRe ez8PAbnGRDGjrZVczb7wJsPL4sVeWObBmKnR39KJ6x3eXCfkfkAUoKhmUjkuUirjE3XP mEIUYkUaPUx+KMT76BPFVLNW/KEvz4pmjFi97zlInaKldgLoSq1UeXPG+6eEjLKCAXyI F4Yr65IQUgtswR0v4JQ/qhfuRm3QBwukRbmDfG/b3ntjgql3FOwxbDwMXHsp6xGY0gPK 1xOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=ta21b+MoGb5R21YGV2Bu7zBl0s7JQS2Y7To4G7tfKEs=; b=kSirI/Tq6GRsZuQxOq2GQmriDiArEp7rR+u1rNLk61zvzpZVJWefuveuKGdMIvsxyr 4w8cxDnZxPSnwV1ZgAqkkoInNUP2dazTm9bgu6pre9o40poxVJeMAI+ERjUelgaDuvMO 5f4z4M8SscEl0VtNakuy1Xa9WP4BKlf4vR9H+A3Tce9wu2r1AtusTodUIq+frsL67WUJ yRITiVFmnxYHuSXg3YUk4BR1fjzVPMwD/bhoZ/PM8umqE3FAR0IH46ErkHPYS8Ed2VD/ rV7s9Hl1ecSaMX7yoinUnconhBhjeXpuqCc8TuPuIoBKB7N5/XCBaMr0XkAYOSUoTrUn DI9g== X-Gm-Message-State: AOUpUlHKB4uf0l4gpqxlc55LTxBXZ4vtDbmuDsBMtU4/DSTQvPBbJSWx 1Up46lWLgsoizLMn5hOkfow= X-Google-Smtp-Source: AA+uWPxOISy264NZiV2rnj0W3B9mOXCtQBJHh0Z2pqO2Zad7jyXOkb0dk7naSH0WQzKWW6fICFZTug== X-Received: by 2002:aca:4808:: with SMTP id v8-v6mr15762090oia.259.1534790915485; Mon, 20 Aug 2018 11:48:35 -0700 (PDT) Received: from localhost.localdomain (cpe-24-31-245-230.kc.res.rr.com. [24.31.245.230]) by smtp.gmail.com with ESMTPSA id x5-v6sm10487268oix.3.2018.08.20.11.48.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 11:48:34 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Larry Finger Subject: [PATCH] rtl8187: Fix warning generated when strncpy() destination length matches the sixe argument Date: Mon, 20 Aug 2018 13:48:31 -0500 Message-Id: <20180820184831.24206-1-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.18.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In gcc8, when the 3rd argument (size) of a call to strncpy() matches the length of the first argument, the compiler warns of the possibility of an unterminated string. Using strlcpy() forces a null at the end. Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c index c2d5b495c179..c089540116fa 100644 --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c @@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev, led->dev = dev; led->ledpin = ledpin; led->is_radio = is_radio; - strncpy(led->name, name, sizeof(led->name)); + strlcpy(led->name, name, sizeof(led->name)); led->led_dev.name = led->name; led->led_dev.default_trigger = default_trigger;