Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2018259pxb; Mon, 22 Feb 2021 17:55:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgEbAqgwnKksN5N24n3Ix5qoWam2klYt8lRvdRArwmMqZqcFP9uCocYvV3BFTwpixq819o X-Received: by 2002:a05:6402:2690:: with SMTP id w16mr25765992edd.304.1614045302269; Mon, 22 Feb 2021 17:55:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614045302; cv=none; d=google.com; s=arc-20160816; b=AsEtzen+/IfbseFb0J8coDVb5+wxr9Zjq0UC0X9x8W2FktJTFrwa525nVWWt8Gm5L0 dpC/XXSd8BnbuYaptTFtHTBjhTyc1JnmCNAdibE3q75j8wBjsG21yHCXdosCtoiU9//a eAaY+Kb3/lO4BYiYU7bKUeYzLuLkxTlQ2u0iRdLUMxA/yMJnVXg3Mm9WDZ8hljZofc9h QQ1d0W5xtfBGrQhjBULh2kO/cbrk8uYpItXz+oIrXrCOYXHsb4jtDr6j1DoNBH5ZYF8S CDe2MxdgVuhWPcMhyibn3dlhi/b0NZfTOnPcxzbX6+8imTl5tfKnfwrpKmGBA+u7yrPj v9Ig== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QzL/GPU8mfGoF8mu35RTm6HHOYYEU2XefEslkTT3FJ0=; b=q7xlkkWlL9lgmMRAkVHXYmGg7SXwdc+1lqjvRnQjNKDjprE//TOHqW8azrfe1iqNwg oBcHjx41i2+IWRSm0Vwejcfnvg8PISZlZziXDqXJ/lnMdLNPf3SngY9Qa8ZY5DK5ZQ4M BnI28wcYZooQnOnb3bOHIGSl7H3H9La6RWyBzwoHNyx74gEQrVd0nKsQZF4eUVDhKoQQ 7EH1sOn0vL54+kmZLzyDK0pslu6C4lnPCYBFdAbk//HCfXp7cgNV30SVME6aO5pNTJad LLNV3hPGOeimss7Loo9vHPmUdkxwvlaEluBlfuBl4JDa2vSZzcRKXfnM1baYzLsnoPZ1 tS8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cXK+vcvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si14020583edd.608.2021.02.22.17.54.39; Mon, 22 Feb 2021 17:55:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cXK+vcvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbhBWA5K (ORCPT + 99 others); Mon, 22 Feb 2021 19:57:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:34380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbhBWA5H (ORCPT ); Mon, 22 Feb 2021 19:57:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6203064E5C; Tue, 23 Feb 2021 00:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614041786; bh=3pY5WFu1Ga0y3dwlJnmXoQgzLy9gOhz0VuznV36Gg24=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cXK+vcvBZwqwIZytW45gLGGcfHwosMNnQY8yLN+O4lHN4LdEddmh/wGvYOlAKwcwa Z9IYeD78H/LYAVskG/VV9SEBvJGmtfDQ6WMuf/gY+rsK7c4TDGeuv+hQJEmN6/krSN FGK+V/YQt5EigKGfBBbvi59IHiLBoVbk4Qbg5yIcD2cdSyogc8b1xCVYk9/L1BbSRn EHCMMPzPavUFexmxBzEcMpPuQQg3LmjNXmnN+/GK7LjBpGli2FF+vKZxxnPvvGF3we rkc4hKp+Fyh8dPavWrzhHjl2o7+qAf5ZLuC9vQ4jTFCtH8m9+AX55QSPo3FOSSEbJF xlsaJaqjAo7xg== Date: Mon, 22 Feb 2021 16:56:23 -0800 From: Jakub Kicinski To: Romain Perier Cc: Kees Cook , kernel-hardening@lists.openwall.com, Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/20] devlink: Manual replacement of the deprecated strlcpy() with return values Message-ID: <20210222165623.12e31597@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210222151231.22572-4-romain.perier@gmail.com> References: <20210222151231.22572-1-romain.perier@gmail.com> <20210222151231.22572-4-romain.perier@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 Feb 2021 16:12:14 +0100 Romain Perier wrote: > diff --git a/net/core/devlink.c b/net/core/devlink.c > index 737b61c2976e..7eb445460c92 100644 > --- a/net/core/devlink.c > +++ b/net/core/devlink.c > @@ -9461,10 +9461,10 @@ EXPORT_SYMBOL_GPL(devlink_port_param_value_changed); > void devlink_param_value_str_fill(union devlink_param_value *dst_val, > const char *src) > { > - size_t len; > + ssize_t len; > > - len = strlcpy(dst_val->vstr, src, __DEVLINK_PARAM_MAX_STRING_VALUE); > - WARN_ON(len >= __DEVLINK_PARAM_MAX_STRING_VALUE); > + len = strscpy(dst_val->vstr, src, __DEVLINK_PARAM_MAX_STRING_VALUE); > + WARN_ON(len == -E2BIG); WARN_ON(len < 0) ?