Message ID | 20180417214919.8246-1-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E593A498; Tue, 17 Apr 2018 23:49:24 +0200 (CEST) Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by dpdk.org (Postfix) with ESMTP id 13A1AA48D for <dev@dpdk.org>; Tue, 17 Apr 2018 23:49:23 +0200 (CEST) Received: by mail-pl0-f66.google.com with SMTP id t22-v6so4126735plo.7 for <dev@dpdk.org>; Tue, 17 Apr 2018 14:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=YBGDeGgvpYy4IitNmQPS2quqvd8/fgRgUiw2abJ+w9Q=; b=Hj/+7V7lhC9TjJoOu6QAkQ5jxrIfuiGpNc+sDU5b9AMSgfXB9KwLpux7OCIdi4DCVO oUy0q9qDBU/dOMOmat3c7P3+VsbNZjXbt3kx1gYAlyZyBwhHeKdPk0V396EinJiMnddW pA80hrDWIf4Z603l55Nw+1TzfLtM7DcCFBpLj+9D25i+W2FU+9hR4tNOF73RTtQS8RfH cr9+8zKuAiHZtsBJYJSz2M7iaFQLRvsj8z4eBOab1a+AgojhCFD8qmz9ezEONaOeeekk QjGonEkS9CLHgvmJd9ECp/TabeI9CskJaxfA36Cj4PStClXsSWsmqqfOTkM6yPdxYgPk 8QQQ== 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; bh=YBGDeGgvpYy4IitNmQPS2quqvd8/fgRgUiw2abJ+w9Q=; b=N/kvB4x357ebJvbwyeyg7NSrVXhbKmCLDbZgBfuK+M3pWA+K3oL3ua7JWE0gyryA7L x2YOdo59KvxZru2GKck7hi/2UzmWi6nJKJihWkuT89U1kAXGMukHrhEeUp0M5go45N+X XVr5d5F7zLh9wB5vOsK4W6TITx6zJHJUTPY1uOr6l071ezl0FIYvKZp10BY9Bc2tnvgZ LUpjFZn3YK9yLYFkG7KtwM1ftc7X4Pz4WWMLGJBRrKi/UY060g1M7kWT9RnBZA0B88BC dgYvS2VqHLNDRb/3AVqZ4CHMDhgpMeB919n6jaK0ErdoKvcZ2lB/LyAPsKorSuoT2cze Qs4A== X-Gm-Message-State: ALQs6tAPrCK7S6TCwoi4g5vd1+AU263h0HArikbSkIni60h/1cnvck99 5BCWUNWjZjS3aolkOJAxrivva5YePOs= X-Google-Smtp-Source: AIpwx49N8HYwBNsphi4hqiQnkYT4Szx5ZofnVzeeyaT++dO3NJe3BKvDWkx4iGZQcJ7vAAiBhpk8ZA== X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr507188plb.179.1524001761991; Tue, 17 Apr 2018 14:49:21 -0700 (PDT) Received: from xeon-e3.lan (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id e4sm231762pfa.128.2018.04.17.14.49.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 14:49:21 -0700 (PDT) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org> Date: Tue, 17 Apr 2018 14:49:19 -0700 Message-Id: <20180417214919.8246-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.0 Subject: [dpdk-dev] [RFC] checkpatch: don't complain about SPDX tag format X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
ci/Intel-compilation | success | Compilation OK |
Commit Message
Stephen Hemminger
April 17, 2018, 9:49 p.m. UTC
Since DPDK developers have decided to use a different tag format
than the kernel developers, ignore warnings about SPDX tags.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
IMHO would have been better to use the kernel SPDX style and
keep the check but that appears to be a minority opinion.
devtools/checkpatches.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
17/04/2018 23:49, Stephen Hemminger: > IMHO would have been better to use the kernel SPDX style and > keep the check but that appears to be a minority opinion. I think it is better to work on checkpatch itself. When defining our SPDX style, Linux one was not definitive. Do you think we can ask the Linux community to support our SPDX style?
On 18-04-17 03:06 PM, Thomas Monjalon wrote: > 17/04/2018 23:49, Stephen Hemminger: >> IMHO would have been better to use the kernel SPDX style and >> keep the check but that appears to be a minority opinion. > I think it is better to work on checkpatch itself. > When defining our SPDX style, Linux one was not definitive. > Do you think we can ask the Linux community to support our SPDX style? > I think it better to simply follow the Linux community defacto style rather than go your own way.
18/04/2018 00:11, Scott Branden: > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > 17/04/2018 23:49, Stephen Hemminger: > >> IMHO would have been better to use the kernel SPDX style and > >> keep the check but that appears to be a minority opinion. > > > > I think it is better to work on checkpatch itself. > > When defining our SPDX style, Linux one was not definitive. > > Do you think we can ask the Linux community to support our SPDX style? > > > I think it better to simply follow the Linux community defacto style > rather than go your own way. But our way is better! :) And it has been decided in the Technical Board.
On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: > 18/04/2018 00:11, Scott Branden: > > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > > 17/04/2018 23:49, Stephen Hemminger: > > >> IMHO would have been better to use the kernel SPDX style and > > >> keep the check but that appears to be a minority opinion. > > > > > > I think it is better to work on checkpatch itself. > > > When defining our SPDX style, Linux one was not definitive. > > > Do you think we can ask the Linux community to support our SPDX style? > > > > > I think it better to simply follow the Linux community defacto style > > rather than go your own way. > > But our way is better! :) > And it has been decided in the Technical Board. > As a general issue, I think we could do with having our own checkpatch-like script for performing addition DPDK-specific code-checks *after* Linux checkpatch ones. That is, reuse Linux check patch checks as much as possible, but have other checks too. For example, check for use of strcpy or strncpy (or snprintf with "%s") and suggest replacing with strlcpy. If we did have our own extension script, we could put our own SPDX format check there too. Thoughts, or any volunteers to look into this? /Bruce
Kuusisaari, Juhamatti (Infinera - FI/Espoo)
April 18, 2018, 10:49 a.m. UTC |
#5
Addressed
Unaddressed
Hello, > On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: > > 18/04/2018 00:11, Scott Branden: > > > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > > > 17/04/2018 23:49, Stephen Hemminger: > > > >> IMHO would have been better to use the kernel SPDX style and keep > > > >> the check but that appears to be a minority opinion. > > > > > > > > I think it is better to work on checkpatch itself. > > > > When defining our SPDX style, Linux one was not definitive. > > > > Do you think we can ask the Linux community to support our SPDX style? > > > > > > > I think it better to simply follow the Linux community defacto style > > > rather than go your own way. > > > > But our way is better! :) > > And it has been decided in the Technical Board. > > > > As a general issue, I think we could do with having our own checkpatch-like > script for performing addition DPDK-specific code-checks *after* Linux > checkpatch ones. That is, reuse Linux check patch checks as much as possible, > but have other checks too. > > For example, check for use of strcpy or strncpy (or snprintf with "%s") and > suggest replacing with strlcpy. If we did have our own extension script, we > could put our own SPDX format check there too. > > Thoughts, or any volunteers to look into this? In addition, the checkpatches.sh could be improved so that it actually checks that a proper file is found behind the selected env variable. I am planning to add this check (as it bite me just yesterday). Speaking of strlcpy, I do think that it has a caveat* that everybody should be aware of: depending on implementation, it may read unintended memory regions when the source is not properly null terminated (like in Unix domain sockets, or just by other mistake). It may be a bad idea just blindly replace everything with strlcpy, without making sure that copied buffers are really null-terminated in the first place or making sure the strlcpy version is really a one that does not have this problem. As it depends on dynamic libraries, making sure may be difficult. Some may argue that this is unlikely and thus irrelevant. Why do I know about it then? :) Needless to say, strncpy or snprintf do not have _this_ problem, although they have their own issues. Internally without dynamic libs DPDK rte_strlcpy uses snprintf which should be safe, though. > /Bruce -- Juhamatti * A caveat on some implementations: ... /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) <- what happens when s is not null-terminated? ; } ... Another one: ... return n + strlen (src); <- what happens when src is not null-terminated? ...
On Wed, Apr 18, 2018 at 10:49:07AM +0000, Kuusisaari, Juhamatti wrote: > > Hello, > > > On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: > > > 18/04/2018 00:11, Scott Branden: > > > > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > > > > 17/04/2018 23:49, Stephen Hemminger: > > > > >> IMHO would have been better to use the kernel SPDX style and keep > > > > >> the check but that appears to be a minority opinion. > > > > > > > > > > I think it is better to work on checkpatch itself. > > > > > When defining our SPDX style, Linux one was not definitive. > > > > > Do you think we can ask the Linux community to support our SPDX style? > > > > > > > > > I think it better to simply follow the Linux community defacto style > > > > rather than go your own way. > > > > > > But our way is better! :) > > > And it has been decided in the Technical Board. > > > > > > > As a general issue, I think we could do with having our own checkpatch-like > > script for performing addition DPDK-specific code-checks *after* Linux > > checkpatch ones. That is, reuse Linux check patch checks as much as possible, > > but have other checks too. > > > > For example, check for use of strcpy or strncpy (or snprintf with "%s") and > > suggest replacing with strlcpy. If we did have our own extension script, we > > could put our own SPDX format check there too. > > > > Thoughts, or any volunteers to look into this? > > In addition, the checkpatches.sh could be improved so that it actually checks that a proper file is found behind the selected env variable. I am planning to add this check (as it bite me just yesterday). > > Speaking of strlcpy, I do think that it has a caveat* that everybody should be aware of: depending on implementation, it may read unintended memory regions when the source is not properly null terminated (like in Unix domain sockets, or just by other mistake). It may be a bad idea just blindly replace everything with strlcpy, without making sure that copied buffers are really null-terminated in the first place or making sure the strlcpy version is really a one that does not have this problem. As it depends on dynamic libraries, making sure may be difficult. > > Some may argue that this is unlikely and thus irrelevant. Why do I know about it then? :) Needless to say, strncpy or snprintf do not have _this_ problem, although they have their own issues. Internally without dynamic libs DPDK rte_strlcpy uses snprintf which should be safe, though. > > > /Bruce > > -- > Juhamatti > > * A caveat on some implementations: > ... > /* Not enough room in dst, add NUL and traverse rest of src */ > if (n == 0) { > if (siz != 0) > *d = '\0'; /* NUL-terminate dst */ > while (*s++) <- what happens when s is not null-terminated? > ; > } > ... > Another one: > ... > return n + strlen (src); <- what happens when src is not null-terminated? > ... Thanks for pointing that out. It's good to be aware of these caveats. I suspect in most cases the replacement is safe, but we should not blindly replace one thing with another without checking for possible unintended side effects. /Bruce
18/04/2018 10:56, Bruce Richardson: > On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: > > 18/04/2018 00:11, Scott Branden: > > > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > > > 17/04/2018 23:49, Stephen Hemminger: > > > >> IMHO would have been better to use the kernel SPDX style and > > > >> keep the check but that appears to be a minority opinion. > > > > > > > > I think it is better to work on checkpatch itself. > > > > When defining our SPDX style, Linux one was not definitive. > > > > Do you think we can ask the Linux community to support our SPDX style? > > > > > > > I think it better to simply follow the Linux community defacto style > > > rather than go your own way. > > > > But our way is better! :) > > And it has been decided in the Technical Board. > > > > As a general issue, I think we could do with having our own checkpatch-like > script for performing addition DPDK-specific code-checks *after* Linux > checkpatch ones. That is, reuse Linux check patch checks as much as > possible, but have other checks too. +1 to call more scripts in checkpatches.sh. We need to find the right language to do code checks. Coccinelle looks to be a good candidate for some checks. > For example, check for use of strcpy or strncpy (or snprintf with "%s") and > suggest replacing with strlcpy. If we did have our own extension script, we > could put our own SPDX format check there too. > > Thoughts, or any volunteers to look into this? I am not volunteer to start the work but I would be glad to contribute later. Any motivated volunteer?
> On Apr 18, 2018, at 8:50 AM, Thomas Monjalon <thomas@monjalon.net> wrote: > > 18/04/2018 10:56, Bruce Richardson: >> On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: >>> 18/04/2018 00:11, Scott Branden: >>>> On 18-04-17 03:06 PM, Thomas Monjalon wrote: >>>>> 17/04/2018 23:49, Stephen Hemminger: >>>>>> IMHO would have been better to use the kernel SPDX style and >>>>>> keep the check but that appears to be a minority opinion. >>>>> >>>>> I think it is better to work on checkpatch itself. >>>>> When defining our SPDX style, Linux one was not definitive. >>>>> Do you think we can ask the Linux community to support our SPDX style? >>>>> >>>> I think it better to simply follow the Linux community defacto style >>>> rather than go your own way. >>> >>> But our way is better! :) >>> And it has been decided in the Technical Board. >>> >> >> As a general issue, I think we could do with having our own checkpatch-like >> script for performing addition DPDK-specific code-checks *after* Linux >> checkpatch ones. That is, reuse Linux check patch checks as much as >> possible, but have other checks too. I too believe we need to support our own checkpatch to better detect and fix DPDK specific issues. > > +1 to call more scripts in checkpatches.sh. > We need to find the right language to do code checks. > Coccinelle looks to be a good candidate for some checks. > >> For example, check for use of strcpy or strncpy (or snprintf with "%s") and >> suggest replacing with strlcpy. If we did have our own extension script, we >> could put our own SPDX format check there too. >> >> Thoughts, or any volunteers to look into this? > > I am not volunteer to start the work but I would be glad to contribute later. > > Any motivated volunteer? Regards, Keith
> 18/04/2018 10:56, Bruce Richardson: > > On Wed, Apr 18, 2018 at 12:19:07AM +0200, Thomas Monjalon wrote: > > > 18/04/2018 00:11, Scott Branden: > > > > On 18-04-17 03:06 PM, Thomas Monjalon wrote: > > > > > 17/04/2018 23:49, Stephen Hemminger: > > > > >> IMHO would have been better to use the kernel SPDX style and > > > > >> keep the check but that appears to be a minority opinion. > > > > > > > > > > I think it is better to work on checkpatch itself. > > > > > When defining our SPDX style, Linux one was not definitive. > > > > > Do you think we can ask the Linux community to support our SPDX style? > > > > > > > > > I think it better to simply follow the Linux community defacto > > > > style rather than go your own way. > > > > > > But our way is better! :) > > > And it has been decided in the Technical Board. > > > > > > > As a general issue, I think we could do with having our own > > checkpatch-like script for performing addition DPDK-specific > > code-checks *after* Linux checkpatch ones. That is, reuse Linux check > > patch checks as much as possible, but have other checks too. > > +1 to call more scripts in checkpatches.sh. > We need to find the right language to do code checks. > Coccinelle looks to be a good candidate for some checks. > > > For example, check for use of strcpy or strncpy (or snprintf with > > "%s") and suggest replacing with strlcpy. If we did have our own > > extension script, we could put our own SPDX format check there too. > > > > Thoughts, or any volunteers to look into this? > > I am not volunteer to start the work but I would be glad to contribute later. > > Any motivated volunteer? > [Hemant] yes, we need volunteer 😊 In DPDK we have following requirements 1. Check the SPDX tag on the files. 2. Validate the valid license SPDX tag. (BSD-3 and Dual for all except kernel folder). Regards, Hemant
17/04/2018 23:49, Stephen Hemminger: > Since DPDK developers have decided to use a different tag format > than the kernel developers, ignore warnings about SPDX tags. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Applied, thanks
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 7676a6b50141..b438fbcd6737 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -42,7 +42,7 @@ options="--no-tree" options="$options --max-line-length=$length" options="$options --show-types" options="$options --ignore=LINUX_VERSION_CODE,\ -FILE_PATH_CHANGES,MAINTAINERS_STYLE,\ +FILE_PATH_CHANGES,MAINTAINERS_STYLE,SPDX_LICENSE_TAG,\ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\ SPLIT_STRING,LONG_LINE_STRING,\