* [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
@ 2026-08-26 14:53 3237174131
2026-08-26 15:30 ` Greg KH
2026-08-26 16:42 ` Jonathan Corbet
0 siblings, 2 replies; 4+ messages in thread
From: 3237174131 @ 2026-08-26 14:53 UTC (permalink / raw)
To: linux-kernel; +Cc: tglx, gregkh
[-- Attachment #1: Type: text/plain, Size: 128 bytes --]
Hi all,
This is my first kernel patch. Please let me know if anything is wrong.
Signed-off-by: Xia Zhoxin <3237174131@qq.com>
[-- Attachment #2: 0001-scripts-spdxcheck-fix-file-descriptor-leak.patch --]
[-- Type: application/octet-stream, Size: 925 bytes --]
From: Xia Zhoxin <3237174131@qq.com>
Subject: [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
To: linux-kernel@vger.kernel.org
Cc: tglx@kernel.org, gregkh@linuxfoundation.org
Hi all,
This is my first kernel patch. Please let me know if anything is wrong.
Signed-off-by: Xia Zhoxin <3237174131@qq.com>
---
scripts/spdxcheck.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -72,7 +72,8 @@ def read_spdxdata(repo):
exception = None
- for l in open(el.path, encoding="utf-8").readlines():
+ with open(el.path, encoding="utf-8") as f:
+ for l in f:
if l.startswith('Valid-License-Identifier:'):
lid = l.split(':')[1].strip().upper()
if lid in spdx.licenses:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
2026-08-26 14:53 [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata() 3237174131
@ 2026-08-26 15:30 ` Greg KH
2026-08-26 16:42 ` Jonathan Corbet
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-08-26 15:30 UTC (permalink / raw)
To: 3237174131; +Cc: linux-kernel, tglx
On Wed, Aug 26, 2026 at 07:53:25AM -0700, 3237174131@qq.com wrote:
> Hi all,
>
> This is my first kernel patch. Please let me know if anything is wrong.
>
> Signed-off-by: Xia Zhoxin <3237174131@qq.com>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch was attached, please place it inline so that it can be
applied directly from the email message itself.
- You did not specify a description of why the patch is needed, or
possibly, any description at all, in the email body. Please read the
section entitled "The canonical patch format" in the kernel file,
Documentation/process/submitting-patches.rst for what is needed in
order to properly describe the change.
- You did not write a descriptive Subject: for the patch, allowing Greg,
and everyone else, to know what this patch is all about. Please read
the section entitled "The canonical patch format" in the kernel file,
Documentation/process/submitting-patches.rst for what a proper
Subject: line should look like.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
2026-08-26 14:53 [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata() 3237174131
2026-08-26 15:30 ` Greg KH
@ 2026-08-26 16:42 ` Jonathan Corbet
1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2026-08-26 16:42 UTC (permalink / raw)
To: 3237174131, linux-kernel; +Cc: tglx, gregkh
3237174131@qq.com writes:
> Hi all,
>
> This is my first kernel patch. Please let me know if anything is wrong.
Sending the patch as an attachment and the lack of a useful changelog
are both problems; please see
Documentation/process/submitting-patches.rst for information on how to
do this properly.
But, beyond that:
> Signed-off-by: Xia Zhoxin <3237174131@qq.com>
> From: Xia Zhoxin <3237174131@qq.com>
> Subject: [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
> To: linux-kernel@vger.kernel.org
> Cc: tglx@kernel.org, gregkh@linuxfoundation.org
>
> Hi all,
>
> This is my first kernel patch. Please let me know if anything is wrong.
>
> Signed-off-by: Xia Zhoxin <3237174131@qq.com>
> ---
> scripts/spdxcheck.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
> --- a/scripts/spdxcheck.py
> +++ b/scripts/spdxcheck.py
> @@ -72,7 +72,8 @@ def read_spdxdata(repo):
> exception = None
> - for l in open(el.path, encoding="utf-8").readlines():
> + with open(el.path, encoding="utf-8") as f:
> + for l in f:
> if l.startswith('Valid-License-Identifier:'):
open() returns a file object (*not* a file descriptor) that will
immediately go to a reference count of zero once .readlines() completes.
Garbage collection will then clean it up. So there is no actual leak
here.
Thanks,
jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata()
@ 2026-08-25 13:46 夏 周鑫
0 siblings, 0 replies; 4+ messages in thread
From: 夏 周鑫 @ 2026-08-25 13:46 UTC (permalink / raw)
To: linux-kernel; +Cc: tglx, gregkh
Hi all,
This is my first kernel patch. Please let me know if anything is wrong.
Signed-off-by: Xia Zhoxin <x15726828610@outlook.com>
---
scripts/spdxcheck.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -72,7 +72,8 @@ def read_spdxdata(repo):
exception = None
- for l in open(el.path, encoding="utf-8").readlines():
+ with open(el.path, encoding="utf-8") as f:
+ for l in f:
if l.startswith('Valid-License-Identifier:'):
lid = l.split(':')[1].strip().upper()
if lid in spdx.licenses:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-26 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 14:53 [PATCH] scripts/spdxcheck: fix file descriptor leak in read_spdxdata() 3237174131
2026-08-26 15:30 ` Greg KH
2026-08-26 16:42 ` Jonathan Corbet
-- strict thread matches above, loose matches on Subject: below --
2026-08-25 13:46 夏 周鑫
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®