From patchwork Sun Jan 31 17:28:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5708C433E0 for ; Sun, 31 Jan 2021 20:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60A6964E22 for ; Sun, 31 Jan 2021 20:09:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbhAaUIi (ORCPT ); Sun, 31 Jan 2021 15:08:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbhAaTqL (ORCPT ); Sun, 31 Jan 2021 14:46:11 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B15AC061793; Sun, 31 Jan 2021 09:31:15 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id y10so4410762plk.7; Sun, 31 Jan 2021 09:31:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TEuL+hVALlT8knIGIfWrKAZ33sVizOsXkuWP5jla1Js=; b=ANSbmVI1xwMVRP1E0zjIWUnQq6BtG0DwLwTiHADYdhlxw+zYHUFBREJvvy1Ftb24W7 wyXCThnYlwN/wCCjn6aXE1sbHGDpfKlQdGAnjo4OBYMR31sblgGE59ToHFB9zQZCwH+/ 6Ct4bxT1MTB5R+04ZmXaKmt64SSh5yiQ2dw5J420g0LA3Q3ta1PKeWyhNENozGoB1Sbv lgs9zi/fY7QXvt1MD1QzlCr54G9o4hwxiS9EoR7jsvu5+ffww09twJrJbikAY8LqrdLt FFhCrwiVdkW/mFVkFj9FiN03y1OATjCPUhUJwI5e0UX7dW4MdgGPnSujGAb/fehHbUl+ GYxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TEuL+hVALlT8knIGIfWrKAZ33sVizOsXkuWP5jla1Js=; b=g6OzSXSc7nTG1etEfzMCrHdL1/wyBlR5giurjuq7SQskiF/49/AM6Q6ow2pV7dtQZP g9bwOVE2qafKuqsp4Chhwx1au0KWCI0R3Js58CdmQVSgBF3HXP3xSf/ucGskYgyzXPqZ 9wexbVPr+MDqDLjKKongnC6SOKlMNy3r0NBe1XKXTckjDY0Tzi5KM9/hzOvtBc59g8kN DXD+wK36PyBmIrLcrxpygqLBtBYrFJoUcZTidjXcCQFKn6yicn2quSgn8MXnd7o6cjTR /ezL40WkXlSHwAEMrr8I8QkLoyKma9TWxHugTUlxB9MNjZCiHihaHz9ETXYJgNCN6WJT HxmQ== X-Gm-Message-State: AOAM532s8j+N3gPMIcFX0DBD0xLSwJXjMRf+CG8/RZTnFrLs5sX6B/GG mqW1K8FT8AtfNO1Vv1Mct4Fq1Kyg2vq1gw== X-Google-Smtp-Source: ABdhPJwClbOYDSZgU1qyhZKF5sKoWjPX/HRVrzUbA9w6Ly4Wkml4MfQKKspYRwVmGG102CbvmJnvxg== X-Received: by 2002:a17:902:b116:b029:e1:58b2:2280 with SMTP id q22-20020a170902b116b02900e158b22280mr2028228plr.29.1612114274980; Sun, 31 Jan 2021 09:31:14 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id r194sm14995355pfr.168.2021.01.31.09.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:31:14 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , Florian Fainelli , Al Viro , William Cohen , Mike Rapoport , Thomas Gleixner , Robert Richter , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 02/13] staging: greybus: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:23 +0530 Message-Id: <20210131172838.146706-3-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi Reviewed-by: Alex Elder --- drivers/staging/greybus/audio_helper.c | 2 +- drivers/staging/greybus/audio_module.c | 2 +- drivers/staging/greybus/audio_topology.c | 6 +++--- drivers/staging/greybus/power_supply.c | 2 +- drivers/staging/greybus/spilib.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c index 3011b8abc..1ed4772d2 100644 --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -166,7 +166,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev, snprintf(id.name, sizeof(id.name), "%s %s", prefix, control->name); else - strlcpy(id.name, control->name, sizeof(id.name)); + strscpy(id.name, control->name, sizeof(id.name)); id.numid = 0; id.iface = control->iface; id.device = control->device; diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index a243d60f0..0f9fdc077 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -342,7 +342,7 @@ static int gb_audio_probe(struct gb_bundle *bundle, /* inform above layer for uevent */ dev_dbg(dev, "Inform set_event:%d to above layer\n", 1); /* prepare for the audio manager */ - strlcpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN); + strscpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN); desc.vid = 2; /* todo */ desc.pid = 3; /* todo */ desc.intf_id = gbmodule->dev_id; diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 662e3e8b4..e816e4db5 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -200,7 +200,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, return -EINVAL; name = gbaudio_map_controlid(module, data->ctl_id, uinfo->value.enumerated.item); - strlcpy(uinfo->value.enumerated.name, name, NAME_SIZE); + strscpy(uinfo->value.enumerated.name, name, NAME_SIZE); break; default: dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n", @@ -1047,7 +1047,7 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, } /* Prefix dev_id to widget control_name */ - strlcpy(temp_name, w->name, NAME_SIZE); + strscpy(temp_name, w->name, NAME_SIZE); snprintf(w->name, NAME_SIZE, "GB %d %s", module->dev_id, temp_name); switch (w->type) { @@ -1169,7 +1169,7 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, } control->id = curr->id; /* Prefix dev_id to widget_name */ - strlcpy(temp_name, curr->name, NAME_SIZE); + strscpy(temp_name, curr->name, NAME_SIZE); snprintf(curr->name, NAME_SIZE, "GB %d %s", module->dev_id, temp_name); control->name = curr->name; diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index ec96f2888..75cb170e0 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -449,7 +449,7 @@ static int __gb_power_supply_set_name(char *init_name, char *name, size_t len) if (!strlen(init_name)) init_name = "gb_power_supply"; - strlcpy(name, init_name, len); + strscpy(name, init_name, len); while ((ret < len) && (psy = power_supply_get_by_name(name))) { power_supply_put(psy); diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c index fc27c52de..672d540d3 100644 --- a/drivers/staging/greybus/spilib.c +++ b/drivers/staging/greybus/spilib.c @@ -455,10 +455,10 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs) dev_type = response.device_type; if (dev_type == GB_SPI_SPI_DEV) - strlcpy(spi_board.modalias, "spidev", + strscpy(spi_board.modalias, "spidev", sizeof(spi_board.modalias)); else if (dev_type == GB_SPI_SPI_NOR) - strlcpy(spi_board.modalias, "spi-nor", + strscpy(spi_board.modalias, "spi-nor", sizeof(spi_board.modalias)); else if (dev_type == GB_SPI_SPI_MODALIAS) memcpy(spi_board.modalias, response.name, From patchwork Sun Jan 31 17:28:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374126 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2213C433E6 for ; Sun, 31 Jan 2021 20:08:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 546F564E22 for ; Sun, 31 Jan 2021 20:08:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbhAaUIY (ORCPT ); Sun, 31 Jan 2021 15:08:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231374AbhAaTqL (ORCPT ); Sun, 31 Jan 2021 14:46:11 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61FB6C0617A7; Sun, 31 Jan 2021 09:31:57 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id j12so9992415pfj.12; Sun, 31 Jan 2021 09:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qJkSDHaVmo+fJzrmd85PruQ7oVf+hPtIrZplmqs4FsA=; b=jseMqVYIOvqKcPA/OwJOxqo47r1bns7PdZ92MYc8WnLySr4D9EAs7DqgJS0+aE8YHp R8TRcr2mBuWyyAAy5kMFW74lfmeeAxESnQcBgiyn/Ygtzlc+X17sQFhrX3RuiD7jBgjA kQQFOh8zaCwGjKXkO8QQoXf8ti/f7oF7bAzBdFLX6mLNQ56pgi8gdyBaigXw2eEJbFei JREaN7WndHVD5yH56eDTFcjU5L0djrKpOR1X+ITgwK8+NY3wg0y3WgqE03YhgPG9aOLt uqhg3IIWZ1ghNrXu+IabOuwbbptykfG8YcpVq4enlECFi01637z7p7cYH+nTI21I+C0T dnhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qJkSDHaVmo+fJzrmd85PruQ7oVf+hPtIrZplmqs4FsA=; b=S3WT3wWog/FPSURSKS9v1t+bzpuhY/rA7S7wDEZQdPT6qRkAmMezn/gAqiPqb3PCUK IFppNG5L+Y5a3/kyXB8wrihJE1EPuiMlFi6k6EB6amolHuryqPi9vIbruQivnwTKV3p3 hCMCGNEJNBU4hiQ7T58ZnzcWftXZUU41ndraB8nIgC0o9sPwQKPlqjXTy1EAzwp47hhO Pn0hH2h6htvwUMmxqPfU8zgv++pDavv91SxD8y3pTn84O5xX91oqGUZHHm0menRG4zMT MThHbdnHfpYzhFvGkAAiXEZgoKoFei/Y0uYBpNixLG9NWe1y7w62b4IWg4+Q81R8wZ5m ufpw== X-Gm-Message-State: AOAM532UQ1LRLA0qT1HAFx7XlpgBuF7pho8LKkItNTz+g4f++SOz+NQG g/f9fBr2mzCWuC4H7XFU1HyV/Ev6p/gP9Q== X-Google-Smtp-Source: ABdhPJx20zg4Eel9orHc/z6tQYJ/L78aqH6IGuvnMGtz2Lor1bTYfNI80zv9b09QNyvsIwBHoDcw5w== X-Received: by 2002:a62:32c3:0:b029:1bc:7e0:ae66 with SMTP id y186-20020a6232c30000b02901bc07e0ae66mr13089095pfy.53.1612114316906; Sun, 31 Jan 2021 09:31:56 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id z2sm5127218pfa.121.2021.01.31.09.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:31:56 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , Thomas Gleixner , William Cohen , Mike Rapoport , Florian Fainelli , Robert Richter , Al Viro , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 05/13] staging: nvec: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:26 +0530 Message-Id: <20210131172838.146706-6-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/nvec/nvec_ps2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 45db29262..157009015 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -112,8 +112,8 @@ static int nvec_mouse_probe(struct platform_device *pdev) ser_dev->start = ps2_startstreaming; ser_dev->stop = ps2_stopstreaming; - strlcpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name)); - strlcpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys)); + strscpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name)); + strscpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys)); ps2_dev.ser_dev = ser_dev; ps2_dev.notifier.notifier_call = nvec_ps2_notifier; From patchwork Sun Jan 31 17:28:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12D16C433E0 for ; Sun, 31 Jan 2021 20:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB77B64E28 for ; Sun, 31 Jan 2021 20:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbhAaUNb (ORCPT ); Sun, 31 Jan 2021 15:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbhAaTft (ORCPT ); Sun, 31 Jan 2021 14:35:49 -0500 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0475FC0617A9; Sun, 31 Jan 2021 09:32:08 -0800 (PST) Received: by mail-pl1-x642.google.com with SMTP id y10so4411481plk.7; Sun, 31 Jan 2021 09:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8z7T30JwVaWaq0MDWkzbLRl1Zk2i9+kaaFA/9JES7Xs=; b=Uoqbq4QkgIl9VP9kliAkYuDQm21xB+XmNDU1AxMz1RJf8ufeaxxdJyfbPtuk5Ue9Sy MsdwlBDkuXGbADiWX3vmEvafdwHpDVKRSJ9NoYmEi915UYcqRWEQPKMo+cP6rmBvv8bF qkIqPu6ztvPeb9ysJJLiyUFmRIrZVzyr9cs/x02p9cSb4Pt62moPq/QSkjFuqmHJ/4V6 E2opHNxR9Ga44NNvcciGBBq2C025jSGE+TkcgPUq2BZ1KJf5K5IlNq0oVQnrPipGjDLr XRzLuQtPzaP5fBIV1iwtCKI5ZRISbgq/zvxGOm4x9XsH6BxWulI21PlLJsi/m4HS2xyG 1Q6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8z7T30JwVaWaq0MDWkzbLRl1Zk2i9+kaaFA/9JES7Xs=; b=sIPB65a505mtAz2pweoDMnJJ0aDeRQcVfOnkeXojixCpqDP4BbPHS/fl2XBK/pfjDp CzfdV01RreRZk7iohA4gWNrp+FaK3HgyEkd7I1I85drvT0YGZTfUaoHg2mboC5+2qKVD ujRM9W5wP4K7gUfXBCnUAcJxlJmOuWc+o6SX3ZYqFI5OkwbfJUsEZq7Y5AJrp6qbwyqq vJMIWGHbuGQzwRwgIfSHgQvqbL0M2J3QpylcRbdmQK6PWSwnMuMsRG97b92omaimYMcX VKvWO1xuGQyTjBLeWQ+ffMbcyMDDlLnsCVA8i1c8ib9TXJ0ZzEEIk7ji1ldc6Qodaul0 b+Ew== X-Gm-Message-State: AOAM5339L+ZwrsX+I2DGRCpO91y3GnyeSkEvfakEJb1HpJRjGz23DHAX Mz0bBJtKYLu9q8hQrqltuKM= X-Google-Smtp-Source: ABdhPJxlrmQpiP0t2W7sFWGvxmRHJQ1EXLzsFuG1+Bm3Y/OPuczoXDBzhNcDmo58qBTT9cFSwqvRTw== X-Received: by 2002:a17:902:eacb:b029:e1:2de4:72b6 with SMTP id p11-20020a170902eacbb02900e12de472b6mr8975072pld.17.1612114327515; Sun, 31 Jan 2021 09:32:07 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id 76sm14898291pfz.174.2021.01.31.09.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:32:06 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , William Cohen , Florian Fainelli , Al Viro , Mike Rapoport , Robert Richter , Thomas Gleixner , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 06/13] staging: octeon: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:27 +0530 Message-Id: <20210131172838.146706-7-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi Reviewed-by: Robert Richter --- drivers/staging/octeon/ethernet-mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 0bf545849..1bb91a904 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -21,9 +21,9 @@ static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strlcpy(info->version, UTS_RELEASE, sizeof(info->version)); - strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info)); + strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); + strscpy(info->version, UTS_RELEASE, sizeof(info->version)); + strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); } static int cvm_oct_nway_reset(struct net_device *dev) From patchwork Sun Jan 31 17:28:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84C69C433E0 for ; Sun, 31 Jan 2021 20:07:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CA7864E22 for ; Sun, 31 Jan 2021 20:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbhAaTre (ORCPT ); Sun, 31 Jan 2021 14:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbhAaTmV (ORCPT ); Sun, 31 Jan 2021 14:42:21 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D7DDC0617AA; Sun, 31 Jan 2021 09:32:17 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id b145so3217395pfb.4; Sun, 31 Jan 2021 09:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9mx9QDkqfNUwWdACyM2Fn2TS+NlXzO5XMeT4wvvF4yM=; b=FKhRyOzoZSbBuvWwr0fTJ+iFeZN7JT2FPX2669eIzdGFo5UYBxWO2lMckA9wnehLTS xHmrEWENAHskb5BhFX6J42HLdCsFefK2aEtxG+yPckdGw3BsDu96v/DESQiAw56isE0b 92NLHHC68hguqKz0GvB+ulD4I9TKRUFtGwmpjbUEFBrTaIf3OgckiVwzJ4/ROpw8BSoX oNKalg6R33IaEWts0MFGrxDLnL3XZx2GMYqee70sRg1dd1sE0JdHazOda1TasbNt87tJ kfglu74r09XJiZR8kMAJf+x7dJ636t7EoxwawooqaIZ/J1affyE1+5moWGYYW8MxlYCO LFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9mx9QDkqfNUwWdACyM2Fn2TS+NlXzO5XMeT4wvvF4yM=; b=GMqBBOI/ry/26SaQkpjrI8HPYrEQA4nXp4z47OB6knDXyP6j9a0KbiP6pPkV7KlhN8 WE1AxWk2ZoyAAikSAa99Axoq2yEacqWhZzmgmjzD7zjR1+pC6RDeL0xl1ErDtScU7w1P bLGmTeSXyfj/+gI86fKpcktuN143g5TdFa8bCwS65m7mLTx4xjiYkhf4/e+EoaIdhhLd 1FETHtyRa/ZYo3Ium6reRfZgMXRRVI5Y2HjIqNTM2tSuF/EvlBnQl66TyaQYOmBgJ6Rk vJbkU2dVThz//WaNMSvmARpViV7+YYm6YF0Aa38PWLRTzHs0uLEV8/l703xDvs9kiz4a /wpA== X-Gm-Message-State: AOAM533t3Oq30JbCXIiD4fidr8wthLDH8y4TIp3RPg+CGkZUpDd+6HNc ZPBcP/lE4+yC9uGobZ9/gx4= X-Google-Smtp-Source: ABdhPJy0FOOeBvw8A30nFmOClcs73UGIMxJUMDIk2k6K7lguT0DTnIX/42iZkIg0q78K2sAG9Txfpw== X-Received: by 2002:a63:c43:: with SMTP id 3mr13088289pgm.250.1612114337079; Sun, 31 Jan 2021 09:32:17 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id y11sm14165281pfn.85.2021.01.31.09.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:32:16 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , William Cohen , Mike Rapoport , Florian Fainelli , Robert Richter , Thomas Gleixner , Al Viro , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 07/13] staging: olpc_dcon: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:28 +0530 Message-Id: <20210131172838.146706-8-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/olpc_dcon/olpc_dcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index e7281212d..6d8e9a481 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c @@ -576,7 +576,7 @@ static struct notifier_block dcon_panic_nb = { static int dcon_detect(struct i2c_client *client, struct i2c_board_info *info) { - strlcpy(info->type, "olpc_dcon", I2C_NAME_SIZE); + strscpy(info->type, "olpc_dcon", I2C_NAME_SIZE); return 0; } From patchwork Sun Jan 31 17:28:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADB87C433E0 for ; Sun, 31 Jan 2021 19:47:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8727164E25 for ; Sun, 31 Jan 2021 19:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231459AbhAaTrc (ORCPT ); Sun, 31 Jan 2021 14:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbhAaTgi (ORCPT ); Sun, 31 Jan 2021 14:36:38 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD631C061351; Sun, 31 Jan 2021 09:32:38 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id e9so9558225pjj.0; Sun, 31 Jan 2021 09:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UATS+ZdWIHunyokeUQ2KzApxYEhPMU9QywnIQp+k1xo=; b=b9PXwhx5E5wwbmXTP1RC5Fki7Zw2VLqiM/m2UxK1wU8m1BcPsvMcbEoZKi8Jo/UQfo row6SlwsGQ4BvNwDVIFQKQ/exYO3s1SXu5odFHUWe5KJyKgB3MdlNG4erlIsz0qCCsKl mWVsToJ0LPw8Jz4M7lkZxQtrfefC0w4E9v94Z8g+fQoBFJWMp5LIJg7kn1zkr+a/kmIX OS6IXKIRgJ0Z6rRVCw55ShwQemSUKLOnG27rkeZv06XzlINdBPCLpuk0AsGiO8EDQq7t DNrGOEj9pmVX5fRmfrorZSbIo7rwnLgXNjJrVAgsXk6dQZJErelCE7Teavl1RfklKb3o Zo8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UATS+ZdWIHunyokeUQ2KzApxYEhPMU9QywnIQp+k1xo=; b=A0pOAKhqQsqOjgR643+zlIVwS+H0qSS8zV26Bs5+T2pkUeJu85gxbp/u1O1fY+dSmq FDPhFyRqulkKmgItPIm5ZqWguqw9qaFn0v6U2x7Cb4DhvOeHmAFAxAj1vyudaO1RjfWw FX0NDJUnjYn5DPO1Uw1ZzsABGelYFx1OrKtr0Ln/0GokKdbxHE912LAtfWfC6vJp4dNh JGdK1QlLhUZO/WiB9us7CVOGegB7ZGbmQ+hg6Tntar3nlyxF/oHMeMD7pUC2cY6UXd2o zyK/u904DLO/REU70isnkmX8/WGZIz07QQyUlBoZUfRNVun5yZM86uUY3POA6gMVdFFl 1ktw== X-Gm-Message-State: AOAM531YJ1W0kDTcmDHtxI5yig1XvLEIcKehi2uJsUe9AHT5cwyjNzSb XxAwAVS4cqNULvF3sv2bj1A= X-Google-Smtp-Source: ABdhPJxtoGANsdEpKKge2o/29AN1E8VfPfLdlwcKVddQbVKTDT3+km65hFEkM3txwdasUFD8QbEDvQ== X-Received: by 2002:a17:90a:778b:: with SMTP id v11mr13218923pjk.61.1612114358345; Sun, 31 Jan 2021 09:32:38 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id y16sm15492888pfb.83.2021.01.31.09.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:32:37 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , Al Viro , Florian Fainelli , Mike Rapoport , Thomas Gleixner , Robert Richter , William Cohen , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 09/13] staging: rtl8192e: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:30 +0530 Message-Id: <20210131172838.146706-10-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c index 6ae7a67e7..f4f7b74c8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c @@ -18,9 +18,9 @@ static void _rtl92e_ethtool_get_drvinfo(struct net_device *dev, { struct r8192_priv *priv = rtllib_priv(dev); - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info)); + strscpy(info->driver, DRV_NAME, sizeof(info->driver)); + strscpy(info->version, DRV_VERSION, sizeof(info->version)); + strscpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info)); } static u32 _rtl92e_ethtool_get_link(struct net_device *dev) From patchwork Sun Jan 31 17:28:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10B50C433DB for ; Sun, 31 Jan 2021 20:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF9FB64E1F for ; Sun, 31 Jan 2021 20:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231672AbhAaUDn (ORCPT ); Sun, 31 Jan 2021 15:03:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbhAaTs0 (ORCPT ); Sun, 31 Jan 2021 14:48:26 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3448C061352; Sun, 31 Jan 2021 09:32:48 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id o7so10446409pgl.1; Sun, 31 Jan 2021 09:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mo0+brrhGMjJednSGVa7WEJAUXKYi42r2CVW4s4Y5xs=; b=QAkz1tON5iYvjkr2NHcgpozTGPVoPfYRL4IL0BfDh3zUuFMq5MAc0McwM/O6fZxYTx 4Ox6Wp+bygqNnDl+e1e+XZOK8Cn9ZXwWO0yGKqt7AY0w64FQcDxXGdKMjfqfYY7Wcpir qTdPyjnOjGe/hr+t+2gSz6alaE01d7BUa4KwH6+1ZGajL0RoAVzxsrJ7L//OQWb7U5ZR IbbUp31V3HHVm0+gA4trWkKa4jjz7KCsKnILVQNDMBRNjT/IX6/jth0aCQIM44Vn5WBE ZLCisAIdk8IokOJ7qhqv32Rof2XzRSOSCJ00916W7BF1hKgKTiADIs5mFPy+JeqHJ5vu Bgbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mo0+brrhGMjJednSGVa7WEJAUXKYi42r2CVW4s4Y5xs=; b=pW2ipEAa4c8OurKAbOCgtN1Mb4pyztYn+VTxFzsD72SyrKamXgergW3fCLPWCziMH+ a4ES/B+13QbcN07miSwX75Mb6+Wm8sZTqbhEzVjB2JYMG9P9lkEekhRmTYQoLuQzZqsd UF1BDb80FtzpFLHr0VYK9b+flT+YYoyD3wF9GTNUvlfFfT4S+fe/APLjLRkAKt86H6Wd odGU53jRI4dXNous3OiifSaH2Cskfkr8pHlzNJcOj5iQ4qdgNcGveo34Xv3z/nzVc1nn 6sejdOzDVz7UtubxyZ2Zk7xOGPhI8EvaNrBEufgv+BsDvKtwwMB2/wynsV2qT5uYwBMP In4Q== X-Gm-Message-State: AOAM530YnUuVLLwAAozQXQOtAvRbY3E15p8DWbuaxWmdRVuypCN3of7f 3U+WTgUX7ONO7fO1RSzHFaM= X-Google-Smtp-Source: ABdhPJwcxoFrwI/FRC06emoEJxOlhapapq3uXAbaNvZgMSxCrsCYsYe4eF797A5mhxRg8Rzkb7s87g== X-Received: by 2002:a62:ae0c:0:b029:1bc:a0b9:f0aa with SMTP id q12-20020a62ae0c0000b02901bca0b9f0aamr12613811pff.78.1612114368491; Sun, 31 Jan 2021 09:32:48 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id f71sm14799711pfa.138.2021.01.31.09.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:32:47 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , Al Viro , William Cohen , Florian Fainelli , Mike Rapoport , Robert Richter , Thomas Gleixner , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 10/13] staging: rtl8192u: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:31 +0530 Message-Id: <20210131172838.146706-11-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index f434a26cd..afa92ddfa 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -484,7 +484,7 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - strlcpy(wrqu->name, "802.11", IFNAMSIZ); + strscpy(wrqu->name, "802.11", IFNAMSIZ); if (ieee->modulation & IEEE80211_CCK_MODULATION) { strlcat(wrqu->name, "b", IFNAMSIZ); if (ieee->modulation & IEEE80211_OFDM_MODULATION) From patchwork Sun Jan 31 17:28:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 374130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09BD2C433DB for ; Sun, 31 Jan 2021 19:47:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC40364E25 for ; Sun, 31 Jan 2021 19:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbhAaTrY (ORCPT ); Sun, 31 Jan 2021 14:47:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231163AbhAaTgN (ORCPT ); Sun, 31 Jan 2021 14:36:13 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C192C061353; Sun, 31 Jan 2021 09:32:59 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id e19so9999246pfh.6; Sun, 31 Jan 2021 09:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gKI25e/jJLfDV6Kg+PuHK7AdOezrhXeGKxAKRdL5O5c=; b=NZcWTveJhv5rbkJbLgSmHjwf6GQe9APQLUr0ywzyJM8YOZdKLDVjpOlWiqUVM3EYNh kVuCCm5wXBU2CzBpOGGvpr1BpC2rqWrQeI06JQ+SETI199L8+FYBQKp89qv5dG75eYTW KWNOwfxDvOcvULC3hmRatn9Q4lf1Cq3pLf8Qx4umAZfUd4mAYHqrmX4Go7rUJOSRRkJY AsFOhMO81LuYJHC3r4erHnmawkginx2aVB88AKq463Zgz7HOHICH1Nj2Ej16T3V73iQ7 2EiZ8RG+u8M76R39DPXF34+0sdMtwNcnubNW+xTw/tY6N2wafaytjUKh5roXYOGeEtUq rINA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gKI25e/jJLfDV6Kg+PuHK7AdOezrhXeGKxAKRdL5O5c=; b=tt1iT9orJLG3nCuFds1StDkvkG7joNJC81YQB51fg0hfMTjyy7LiKVs1s5jju/rWaP +XFCDu9y1LRwn2aWSRiyGdmHCBYDYwbUrj9JNnPIUcJYmuPB55Pb5rY281Ge5qWH8gyn cKyz9w9g7Rh7KmsnuNwZyF5upk79KlaxIKO5wZOKaE5XPDLEsAAi4oxe66pTmJRt7A6d wUQkgsHT/0FFUoXrJM9oEGzhbGW3ZYFRAHTvdzuheYd8T66jkSDJ78H3e3+JJJj+1OpW S7nCfIZ6wFoU8frb1xfhHvac86nmPLupBRuu5IIfeT6RSyCSRFFVIm4gTevJP+Pw/DfG dyxQ== X-Gm-Message-State: AOAM532zyWTNhl2jKTt38Q3wqXnVPaaDfKFBp4W98gOd+cQ3aAo/jLmQ AOm+boO60LE2yN0oZ07AB/M= X-Google-Smtp-Source: ABdhPJxJdjPPIgHhUA+gd6c590Us77Rv3SAo0M63OGyZ3eELnR08dADDz7f1OMchhqa7A2U6TYf6aw== X-Received: by 2002:a62:7b8a:0:b029:1bb:4a06:bb57 with SMTP id w132-20020a627b8a0000b02901bb4a06bb57mr12418121pfc.47.1612114378549; Sun, 31 Jan 2021 09:32:58 -0800 (PST) Received: from localhost ([2402:3a80:11ea:e144:a2a4:c5ff:fe20:7222]) by smtp.gmail.com with ESMTPSA id a141sm15124191pfa.189.2021.01.31.09.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 09:32:58 -0800 (PST) From: Kumar Kartikeya Dwivedi To: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Kumar Kartikeya Dwivedi , Ian Abbott , H Hartley Sweeten , Ioana Radulescu , Ioana Ciornei , Johan Hovold , Alex Elder , Vaibhav Agarwal , Mark Greer , Rui Miguel Silva , Viresh Kumar , Marc Dietrich , Jens Frederich , Daniel Drake , Jon Nettleton , Larry Finger , Florian Schilhabel , Sudip Mukherjee , Teddy Wang , Stephen Rothwell , Andrew Morton , Robert Richter , Thomas Gleixner , William Cohen , Florian Fainelli , Mike Rapoport , Al Viro , greybus-dev@lists.linaro.org, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH 11/13] staging: rtl8712: Switch from strlcpy to strscpy Date: Sun, 31 Jan 2021 22:58:32 +0530 Message-Id: <20210131172838.146706-12-memxor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210131172838.146706-1-memxor@gmail.com> References: <20210131172838.146706-1-memxor@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index cbaa7a489..81de5a9e6 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -1784,7 +1784,7 @@ static int r871x_wx_set_enc_ext(struct net_device *dev, return -ENOMEM; param->cmd = IEEE_CMD_SET_ENCRYPTION; eth_broadcast_addr(param->sta_addr); - strlcpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); + strscpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); if (pext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) param->u.crypt.set_tx = 0; if (pext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)