From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Slaby <jslaby@suse.cz>
Subject: [static analysis] memory corruption in tty/synclink.c on 64bit
Date: Mon, 17 Sep 2012 14:18:19 +0300 [thread overview]
Message-ID: <20120917111819.GA5769@elgon.mountain> (raw)
I don't think anyone really cares about this but just for laughs here
is the warning:
drivers/tty/synclink.c:5418 usc_process_rxoverrun_sync() warn: potential memory corrupting cast 8 vs 2 bytes
drivers/tty/synclink.c:6414 mgsl_reset_tx_dma_buffers() warn: potential memory corrupting cast 8 vs 2 bytes
drivers/tty/synclink.c:6455 mgsl_reset_rx_dma_buffers() warn: potential memory corrupting cast 8 vs 2 bytes
drivers/tty/synclink.c:6500 mgsl_free_rx_frame_buffers() warn: potential memory corrupting cast 8 vs 2 bytes
6489 /* reset current buffer for reuse */
6490 // pBufEntry->status = 0;
6491 // pBufEntry->count = DMABUFFERSIZE;
6492 *((unsigned long *)&(pBufEntry->count)) = DMABUFFERSIZE;
It looks like the commented out code is the correct code and the code
on line 6492 is the "faster" version? My static checker complains that
it would corrupt the next struct elements on 64 bit. Also it only works
on little endian systems.
typedef struct _DMABUFFERENTRY
{
u32 phys_addr; /* 32-bit flat physical address of data buffer */
volatile u16 count; /* buffer size/data count */
volatile u16 status; /* Control/status field */
volatile u16 rcc; /* character count field */
u16 reserved; /* padding required by 16C32 */
This was there in the original code when it was merged in 2.2.5pre1.
regards,
dan carpenter
next reply other threads:[~2012-09-17 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 11:18 Dan Carpenter [this message]
2012-09-17 13:16 ` Alan Cox
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=20120917111819.GA5769@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®