aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/synclinkmp.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-09-27 02:20:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-29 16:23:33 -0400
commit53d785ccd918d571c227d459477793872676fc02 (patch)
tree538c8f731207bf916aad708b5c39f03b9ab58c55 /drivers/tty/synclinkmp.c
parent268e526b935e794386d75025577b745e6bd57f13 (diff)
TTY: snyclinkmp: forever loop in tx_load_dma_buffer()
My main concern here was the line that said: copy_count = min_t(unsigned short,count,SCABUFSIZE); "count" is an unsigned int here so the cast to unsigned short truncates the upper bits. So if count is 0x10000 then copy_count is 0 and the loop never exits. "count" comes from skb->len in hdlcdev_xmit(). The other min_t() changes are just cleanups. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/synclinkmp.c')
-rw-r--r--drivers/tty/synclinkmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index c77831c7675a..0f6b796c95c5 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -4950,7 +4950,7 @@ CheckAgain:
4950 4950
4951 if ( debug_level >= DEBUG_LEVEL_DATA ) 4951 if ( debug_level >= DEBUG_LEVEL_DATA )
4952 trace_block(info,info->rx_buf_list_ex[StartIndex].virt_addr, 4952 trace_block(info,info->rx_buf_list_ex[StartIndex].virt_addr,
4953 min_t(int, framesize,SCABUFSIZE),0); 4953 min_t(unsigned int, framesize, SCABUFSIZE), 0);
4954 4954
4955 if (framesize) { 4955 if (framesize) {
4956 if (framesize > info->max_frame_size) 4956 if (framesize > info->max_frame_size)
@@ -5015,14 +5015,14 @@ static void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int co
5015 SCADESC_EX *desc_ex; 5015 SCADESC_EX *desc_ex;
5016 5016
5017 if ( debug_level >= DEBUG_LEVEL_DATA ) 5017 if ( debug_level >= DEBUG_LEVEL_DATA )
5018 trace_block(info,buf, min_t(int, count,SCABUFSIZE), 1); 5018 trace_block(info, buf, min_t(unsigned int, count, SCABUFSIZE), 1);
5019 5019
5020 /* Copy source buffer to one or more DMA buffers, starting with 5020 /* Copy source buffer to one or more DMA buffers, starting with
5021 * the first transmit dma buffer. 5021 * the first transmit dma buffer.
5022 */ 5022 */
5023 for(i=0;;) 5023 for(i=0;;)
5024 { 5024 {
5025 copy_count = min_t(unsigned short,count,SCABUFSIZE); 5025 copy_count = min_t(unsigned int, count, SCABUFSIZE);
5026 5026
5027 desc = &info->tx_buf_list[i]; 5027 desc = &info->tx_buf_list[i];
5028 desc_ex = &info->tx_buf_list_ex[i]; 5028 desc_ex = &info->tx_buf_list_ex[i];