From: Dan Carpenter <error27@gmail.com>
To: linux-media@vger.kernel.org
Subject: [bug report] [media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER
Date: Fri, 2 Oct 2026 19:23:21 +0300 [thread overview]
Message-ID: <ar_aeUyAMFPPd3-2@stanley.mountain> (raw)
Hello Media Developers,
Commit 64fbf4445526 ("[media] cx231xx: Added support for Carraera,
Shelby, RDx_253S and VIDEO_GRABBER") from Jul 6, 2010 (linux-next),
leads to the following Smatch static checker warning:
drivers/media/usb/cx231xx/cx231xx-417.c:1354 cx231xx_bulk_copy()
warn: buffer 'buffer' too small user_len=0-u32max for 3 byte copy
drivers/media/usb/cx231xx/cx231xx-417.c
1341 static int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb)
1342 {
1343 struct cx231xx_dmaqueue *dma_q = urb->context;
1344 unsigned char *p_buffer, *buffer;
1345 u32 buffer_size = 0;
1346
1347 p_buffer = urb->transfer_buffer;
1348 buffer_size = urb->actual_length;
Smatch and ChatGPT want an:
if (buffer_size < 3)
return -ESOMETHING;
1349
1350 buffer = kmalloc(buffer_size, GFP_ATOMIC);
1351 if (!buffer)
1352 return -ENOMEM;
1353
--> 1354 memcpy(buffer, dma_q->ps_head, 3);
Otherwise it leads to a crash.
1355 memcpy(buffer+3, p_buffer, buffer_size-3);
1356 memcpy(dma_q->ps_head, p_buffer+buffer_size-3, 3);
1357
1358 p_buffer = buffer;
1359 buffer_filled(p_buffer, buffer_size, urb, dma_q);
1360
1361 kfree(buffer);
1362 return 0;
1363 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
reply other threads:[~2026-10-15 8:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ar_aeUyAMFPPd3-2@stanley.mountain \
--to=error27@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox