mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel memory safety check in a block
@ 2025-10-21 17:57 Biancaa Ramesh
  2025-10-21 18:33 ` [PATCH] media: cx18: " Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Biancaa Ramesh @ 2025-10-21 17:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: Biancaa Ramesh

Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
---
 drivers/media/pci/cx18/cx18-queue.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-queue.c b/drivers/media/pci/cx18/cx18-queue.c
index eeb5513b1d52..025ba4e6e4be 100644
--- a/drivers/media/pci/cx18/cx18-queue.c
+++ b/drivers/media/pci/cx18/cx18-queue.c
@@ -383,9 +383,16 @@ int cx18_stream_alloc(struct cx18_stream *s)
 						 buf->buf, s->buf_size,
 						 s->dma);
 		if (dma_mapping_error(&s->cx->pci_dev->dev, buf->dma_handle)) {
-			kfree(buf->buf);
+			if (buf) {
+        		if (buf->buf){
+            	kfree(buf->buf);
+				buf->buf =NULL;
+				}
+        		kfree(buf);
+				buf=NULL;
+    		}
 			kfree(mdl);
-			kfree(buf);
+			//makes accidental double free less possible
 			break;
 		}
 
-- 
2.43.0


-- 
::DISCLAIMER::

---------------------------------------------------------------------
The 
contents of this e-mail and any attachment(s) are confidential and
intended 
for the named recipient(s) only. Views or opinions, if any,
presented in 
this email are solely those of the author and may not
necessarily reflect 
the views or opinions of SSN Institutions (SSN) or its
affiliates. Any form 
of reproduction, dissemination, copying, disclosure,
modification, 
distribution and / or publication of this message without the
prior written 
consent of authorized representative of SSN is strictly
prohibited. If you 
have received this email in error please delete it and
notify the sender 
immediately.
---------------------------------------------------------------------
Header of this mail should have a valid DKIM signature for the domain 
ssn.edu.in <http://www.ssn.edu.in/>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: cx18: kernel memory safety check in a block
  2025-10-21 17:57 [PATCH] kernel memory safety check in a block Biancaa Ramesh
@ 2025-10-21 18:33 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-10-21 18:33 UTC (permalink / raw)
  To: Biancaa Ramesh, linux-media, Andy Walls, Mauro Carvalho Chehab
  Cc: linux-kernel

…
> ---
>  drivers/media/pci/cx18/cx18-queue.c | 11 +++++++++--
…

Thanks for your try to improve the implementation of the function “cx18_stream_alloc”.
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/media/pci/cx18/cx18-queue.c#L332-L408

I miss some information so far.

1. Helpful change description
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc2#n45

2. Subsystem specification
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc2#n646
   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/media/pci/cx18/cx18-queue.c

3. More appropriate recipient selection
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc2#n231


…
> -- 
> ::DISCLAIMER::
…
> The 
> contents of this e-mail and any attachment(s) are confidential and
…

Such hints are probably misplaced for communication by the means of public mailing lists.

See also once more:
https://subspace.kernel.org/etiquette.html#do-not-include-confidentiality-disclaimers

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-21 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21 17:57 [PATCH] kernel memory safety check in a block Biancaa Ramesh
2025-10-21 18:33 ` [PATCH] media: cx18: " Markus Elfring

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®