idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
23,500
int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, struct kvm_userspace_memory_region *mem) { if (mem->slot >= KVM_USER_MEM_SLOTS) return -EINVAL; return kvm_set_memory_region(kvm, mem); }
+Priv
0
int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, struct kvm_userspace_memory_region *mem) { if (mem->slot >= KVM_USER_MEM_SLOTS) return -EINVAL; return kvm_set_memory_region(kvm, mem); }
@@ -1898,6 +1898,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) int r; struct kvm_vcpu *vcpu, *v; + if (id >= KVM_MAX_VCPUS) + return -EINVAL; + vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) return PTR_ERR(vcpu);
CWE-20
null
null
23,501
void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, gfn_t gfn) { if (memslot && memslot->dirty_bitmap) { unsigned long rel_gfn = gfn - memslot->base_gfn; set_bit_le(rel_gfn, memslot->dirty_bitmap); } }
+Priv
0
void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, gfn_t gfn) { if (memslot && memslot->dirty_bitmap) { unsigned long rel_gfn = gfn - memslot->base_gfn; set_bit_le(rel_gfn, memslot->dirty_bitmap); } }
@@ -1898,6 +1898,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) int r; struct kvm_vcpu *vcpu, *v; + if (id >= KVM_MAX_VCPUS) + return -EINVAL; + vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) return PTR_ERR(vcpu);
CWE-20
null
null
23,502
void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new, u64 last_generation) { if (new) { int id = new->id; struct kvm_memory_slot *old = id_to_memslot(slots, id); unsigned long npages = old->npages; *old = *new; if (new->npages != npages) sort_memslots(slots); } slots->generation = last_generation + 1; }
+Priv
0
void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new, u64 last_generation) { if (new) { int id = new->id; struct kvm_memory_slot *old = id_to_memslot(slots, id); unsigned long npages = old->npages; *old = *new; if (new->npages != npages) sort_memslots(slots); } slots->generation = last_generation + 1; }
@@ -1898,6 +1898,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) int r; struct kvm_vcpu *vcpu, *v; + if (id >= KVM_MAX_VCPUS) + return -EINVAL; + vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) return PTR_ERR(vcpu);
CWE-20
null
null
23,503
static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) *val += *(u32 *)((void *)kvm + offset); spin_unlock(&kvm_lock); return 0; }
+Priv
0
static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) *val += *(u32 *)((void *)kvm + offset); spin_unlock(&kvm_lock); return 0; }
@@ -1898,6 +1898,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) int r; struct kvm_vcpu *vcpu, *v; + if (id >= KVM_MAX_VCPUS) + return -EINVAL; + vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) return PTR_ERR(vcpu);
CWE-20
null
null
23,504
static int udp6_ufo_send_check(struct sk_buff *skb) { const struct ipv6hdr *ipv6h; struct udphdr *uh; if (!pskb_may_pull(skb, sizeof(*uh))) return -EINVAL; if (likely(!skb->encapsulation)) { ipv6h = ipv6_hdr(skb); uh = udp_hdr(skb); uh->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, IPPROTO_UDP, 0); skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_offset = offsetof(struct udphdr, check); skb->ip_summed = CHECKSUM_PARTIAL; } return 0; }
DoS
0
static int udp6_ufo_send_check(struct sk_buff *skb) { const struct ipv6hdr *ipv6h; struct udphdr *uh; if (!pskb_may_pull(skb, sizeof(*uh))) return -EINVAL; if (likely(!skb->encapsulation)) { ipv6h = ipv6_hdr(skb); uh = udp_hdr(skb); uh->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, IPPROTO_UDP, 0); skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_offset = offsetof(struct udphdr, check); skb->ip_summed = CHECKSUM_PARTIAL; } return 0; }
@@ -90,7 +90,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, /* Check if there is enough headroom to insert fragment header. */ tnl_hlen = skb_tnl_header_len(skb); - if (skb_headroom(skb) < (tnl_hlen + frag_hdr_sz)) { + if (skb->mac_header < (tnl_hlen + frag_hdr_sz)) { if (gso_pskb_expand_head(skb, tnl_hlen + frag_hdr_sz)) goto out; }
CWE-189
null
null
23,505
int __init udp_offload_init(void) { return inet6_add_offload(&udpv6_offload, IPPROTO_UDP); }
DoS
0
int __init udp_offload_init(void) { return inet6_add_offload(&udpv6_offload, IPPROTO_UDP); }
@@ -90,7 +90,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, /* Check if there is enough headroom to insert fragment header. */ tnl_hlen = skb_tnl_header_len(skb); - if (skb_headroom(skb) < (tnl_hlen + frag_hdr_sz)) { + if (skb->mac_header < (tnl_hlen + frag_hdr_sz)) { if (gso_pskb_expand_head(skb, tnl_hlen + frag_hdr_sz)) goto out; }
CWE-189
null
null
23,506
static void SendATCommand(struct mp_port *mtpt) { unsigned char ch[] = {0x61,0x74,0x0d,0x0a,0x0}; unsigned char lineControl; unsigned char i=0; unsigned char Divisor = 0xc; lineControl = serial_inp(mtpt,UART_LCR); serial_outp(mtpt,UART_LCR,(lineControl | UART_LCR_DLAB)); serial_outp(mtpt,UART_DLL,(Divisor & 0xff)); serial_outp(mtpt,UART_DLM,(Divisor & 0xff00)>>8); //baudrate is 4800 serial_outp(mtpt,UART_LCR,lineControl); serial_outp(mtpt,UART_LCR,0x03); // N-8-1 serial_outp(mtpt,UART_FCR,7); serial_outp(mtpt,UART_MCR,0x3); while(ch[i]){ while((serial_inp(mtpt,UART_LSR) & 0x60) !=0x60){ ; } serial_outp(mtpt,0,ch[i++]); } }// end of SendATCommand()
+Info
0
static void SendATCommand(struct mp_port *mtpt) { unsigned char ch[] = {0x61,0x74,0x0d,0x0a,0x0}; unsigned char lineControl; unsigned char i=0; unsigned char Divisor = 0xc; lineControl = serial_inp(mtpt,UART_LCR); serial_outp(mtpt,UART_LCR,(lineControl | UART_LCR_DLAB)); serial_outp(mtpt,UART_DLL,(Divisor & 0xff)); serial_outp(mtpt,UART_DLM,(Divisor & 0xff00)>>8); //baudrate is 4800 serial_outp(mtpt,UART_LCR,lineControl); serial_outp(mtpt,UART_LCR,0x03); // N-8-1 serial_outp(mtpt,UART_FCR,7); serial_outp(mtpt,UART_MCR,0x3); while(ch[i]){ while((serial_inp(mtpt,UART_LSR) & 0x60) !=0x60){ ; } serial_outp(mtpt,0,ch[i++]); } }// end of SendATCommand()
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,507
static inline int __mp_put_char(struct sb_uart_port *port, struct circ_buf *circ, unsigned char c) { unsigned long flags; int ret = 0; if (!circ->buf) return 0; spin_lock_irqsave(&port->lock, flags); if (uart_circ_chars_free(circ) != 0) { circ->buf[circ->head] = c; circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); ret = 1; } spin_unlock_irqrestore(&port->lock, flags); return ret; }
+Info
0
static inline int __mp_put_char(struct sb_uart_port *port, struct circ_buf *circ, unsigned char c) { unsigned long flags; int ret = 0; if (!circ->buf) return 0; spin_lock_irqsave(&port->lock, flags); if (uart_circ_chars_free(circ) != 0) { circ->buf[circ->head] = c; circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); ret = 1; } spin_unlock_irqrestore(&port->lock, flags); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,508
static void __mp_start(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; if (!uart_circ_empty(&state->info->xmit) && state->info->xmit.buf && !tty->stopped && !tty->hw_stopped) port->ops->start_tx(port); }
+Info
0
static void __mp_start(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; if (!uart_circ_empty(&state->info->xmit) && state->info->xmit.buf && !tty->stopped && !tty->hw_stopped) port->ops->start_tx(port); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,509
static void autoconfig(struct mp_port *mtpt, unsigned int probeflags) { unsigned char status1, scratch, scratch2, scratch3; unsigned char save_lcr, save_mcr; unsigned long flags; unsigned char u_type; unsigned char b_ret = 0; if (!mtpt->port.iobase && !mtpt->port.mapbase && !mtpt->port.membase) return; DEBUG_AUTOCONF("ttyMP%d: autoconf (0x%04x, 0x%p): ", mtpt->port.line, mtpt->port.iobase, mtpt->port.membase); spin_lock_irqsave(&mtpt->port.lock, flags); if (!(mtpt->port.flags & UPF_BUGGY_UART)) { scratch = serial_inp(mtpt, UART_IER); serial_outp(mtpt, UART_IER, 0); #ifdef __i386__ outb(0xff, 0x080); #endif scratch2 = serial_inp(mtpt, UART_IER) & 0x0f; serial_outp(mtpt, UART_IER, 0x0F); #ifdef __i386__ outb(0, 0x080); #endif scratch3 = serial_inp(mtpt, UART_IER) & 0x0F; serial_outp(mtpt, UART_IER, scratch); if (scratch2 != 0 || scratch3 != 0x0F) { DEBUG_AUTOCONF("IER test failed (%02x, %02x) ", scratch2, scratch3); goto out; } } save_mcr = serial_in(mtpt, UART_MCR); save_lcr = serial_in(mtpt, UART_LCR); if (!(mtpt->port.flags & UPF_SKIP_TEST)) { serial_outp(mtpt, UART_MCR, UART_MCR_LOOP | 0x0A); status1 = serial_inp(mtpt, UART_MSR) & 0xF0; serial_outp(mtpt, UART_MCR, save_mcr); if (status1 != 0x90) { DEBUG_AUTOCONF("LOOP test failed (%02x) ", status1); goto out; } } serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO); scratch = serial_in(mtpt, UART_IIR) >> 6; DEBUG_AUTOCONF("iir=%d ", scratch); if(mtpt->device->nr_ports >= 8) b_ret = read_option_register(mtpt,(MP_OPTR_DIR0 + ((mtpt->port.line)/8))); else b_ret = read_option_register(mtpt,MP_OPTR_DIR0); u_type = (b_ret & 0xf0) >> 4; if(mtpt->port.type == PORT_UNKNOWN ) { switch (u_type) { case DIR_UART_16C550: mtpt->port.type = PORT_16C55X; break; case DIR_UART_16C1050: mtpt->port.type = PORT_16C105X; break; case DIR_UART_16C1050A: if (mtpt->port.line < 2) { mtpt->port.type = PORT_16C105XA; } else { if (mtpt->device->device_id & 0x50) { mtpt->port.type = PORT_16C55X; } else { mtpt->port.type = PORT_16C105X; } } break; default: mtpt->port.type = PORT_UNKNOWN; break; } } if(mtpt->port.type == PORT_UNKNOWN ) { printk("unknow2\n"); switch (scratch) { case 0: case 1: mtpt->port.type = PORT_UNKNOWN; break; case 2: case 3: mtpt->port.type = PORT_16C55X; break; } } serial_outp(mtpt, UART_LCR, save_lcr); mtpt->port.fifosize = uart_config[mtpt->port.type].dfl_xmit_fifo_size; mtpt->capabilities = uart_config[mtpt->port.type].flags; if (mtpt->port.type == PORT_UNKNOWN) goto out; serial_outp(mtpt, UART_MCR, save_mcr); serial_outp(mtpt, UART_FCR, (UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); serial_outp(mtpt, UART_FCR, 0); (void)serial_in(mtpt, UART_RX); serial_outp(mtpt, UART_IER, 0); out: spin_unlock_irqrestore(&mtpt->port.lock, flags); DEBUG_AUTOCONF("type=%s\n", uart_config[mtpt->port.type].name); }
+Info
0
static void autoconfig(struct mp_port *mtpt, unsigned int probeflags) { unsigned char status1, scratch, scratch2, scratch3; unsigned char save_lcr, save_mcr; unsigned long flags; unsigned char u_type; unsigned char b_ret = 0; if (!mtpt->port.iobase && !mtpt->port.mapbase && !mtpt->port.membase) return; DEBUG_AUTOCONF("ttyMP%d: autoconf (0x%04x, 0x%p): ", mtpt->port.line, mtpt->port.iobase, mtpt->port.membase); spin_lock_irqsave(&mtpt->port.lock, flags); if (!(mtpt->port.flags & UPF_BUGGY_UART)) { scratch = serial_inp(mtpt, UART_IER); serial_outp(mtpt, UART_IER, 0); #ifdef __i386__ outb(0xff, 0x080); #endif scratch2 = serial_inp(mtpt, UART_IER) & 0x0f; serial_outp(mtpt, UART_IER, 0x0F); #ifdef __i386__ outb(0, 0x080); #endif scratch3 = serial_inp(mtpt, UART_IER) & 0x0F; serial_outp(mtpt, UART_IER, scratch); if (scratch2 != 0 || scratch3 != 0x0F) { DEBUG_AUTOCONF("IER test failed (%02x, %02x) ", scratch2, scratch3); goto out; } } save_mcr = serial_in(mtpt, UART_MCR); save_lcr = serial_in(mtpt, UART_LCR); if (!(mtpt->port.flags & UPF_SKIP_TEST)) { serial_outp(mtpt, UART_MCR, UART_MCR_LOOP | 0x0A); status1 = serial_inp(mtpt, UART_MSR) & 0xF0; serial_outp(mtpt, UART_MCR, save_mcr); if (status1 != 0x90) { DEBUG_AUTOCONF("LOOP test failed (%02x) ", status1); goto out; } } serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO); scratch = serial_in(mtpt, UART_IIR) >> 6; DEBUG_AUTOCONF("iir=%d ", scratch); if(mtpt->device->nr_ports >= 8) b_ret = read_option_register(mtpt,(MP_OPTR_DIR0 + ((mtpt->port.line)/8))); else b_ret = read_option_register(mtpt,MP_OPTR_DIR0); u_type = (b_ret & 0xf0) >> 4; if(mtpt->port.type == PORT_UNKNOWN ) { switch (u_type) { case DIR_UART_16C550: mtpt->port.type = PORT_16C55X; break; case DIR_UART_16C1050: mtpt->port.type = PORT_16C105X; break; case DIR_UART_16C1050A: if (mtpt->port.line < 2) { mtpt->port.type = PORT_16C105XA; } else { if (mtpt->device->device_id & 0x50) { mtpt->port.type = PORT_16C55X; } else { mtpt->port.type = PORT_16C105X; } } break; default: mtpt->port.type = PORT_UNKNOWN; break; } } if(mtpt->port.type == PORT_UNKNOWN ) { printk("unknow2\n"); switch (scratch) { case 0: case 1: mtpt->port.type = PORT_UNKNOWN; break; case 2: case 3: mtpt->port.type = PORT_16C55X; break; } } serial_outp(mtpt, UART_LCR, save_lcr); mtpt->port.fifosize = uart_config[mtpt->port.type].dfl_xmit_fifo_size; mtpt->capabilities = uart_config[mtpt->port.type].flags; if (mtpt->port.type == PORT_UNKNOWN) goto out; serial_outp(mtpt, UART_MCR, save_mcr); serial_outp(mtpt, UART_FCR, (UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); serial_outp(mtpt, UART_FCR, 0); (void)serial_in(mtpt, UART_RX); serial_outp(mtpt, UART_IER, 0); out: spin_unlock_irqrestore(&mtpt->port.lock, flags); DEBUG_AUTOCONF("type=%s\n", uart_config[mtpt->port.type].name); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,510
static void autoconfig_irq(struct mp_port *mtpt) { unsigned char save_mcr, save_ier; unsigned long irqs; int irq; /* forget possible initially masked and pending IRQ */ probe_irq_off(probe_irq_on()); save_mcr = serial_inp(mtpt, UART_MCR); save_ier = serial_inp(mtpt, UART_IER); serial_outp(mtpt, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2); irqs = probe_irq_on(); serial_outp(mtpt, UART_MCR, 0); serial_outp(mtpt, UART_MCR, UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2); serial_outp(mtpt, UART_IER, 0x0f); /* enable all intrs */ (void)serial_inp(mtpt, UART_LSR); (void)serial_inp(mtpt, UART_RX); (void)serial_inp(mtpt, UART_IIR); (void)serial_inp(mtpt, UART_MSR); serial_outp(mtpt, UART_TX, 0xFF); irq = probe_irq_off(irqs); serial_outp(mtpt, UART_MCR, save_mcr); serial_outp(mtpt, UART_IER, save_ier); mtpt->port.irq = (irq > 0) ? irq : 0; }
+Info
0
static void autoconfig_irq(struct mp_port *mtpt) { unsigned char save_mcr, save_ier; unsigned long irqs; int irq; /* forget possible initially masked and pending IRQ */ probe_irq_off(probe_irq_on()); save_mcr = serial_inp(mtpt, UART_MCR); save_ier = serial_inp(mtpt, UART_IER); serial_outp(mtpt, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2); irqs = probe_irq_on(); serial_outp(mtpt, UART_MCR, 0); serial_outp(mtpt, UART_MCR, UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2); serial_outp(mtpt, UART_IER, 0x0f); /* enable all intrs */ (void)serial_inp(mtpt, UART_LSR); (void)serial_inp(mtpt, UART_RX); (void)serial_inp(mtpt, UART_IIR); (void)serial_inp(mtpt, UART_MSR); serial_outp(mtpt, UART_TX, 0xFF); irq = probe_irq_off(irqs); serial_outp(mtpt, UART_MCR, save_mcr); serial_outp(mtpt, UART_IER, save_ier); mtpt->port.irq = (irq > 0) ? irq : 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,511
static _INLINE_ void check_modem_status(struct mp_port *mtpt) { int status; status = serial_in(mtpt, UART_MSR); if ((status & UART_MSR_ANY_DELTA) == 0) return; if (status & UART_MSR_TERI) mtpt->port.icount.rng++; if (status & UART_MSR_DDSR) mtpt->port.icount.dsr++; if (status & UART_MSR_DDCD) sb_uart_handle_dcd_change(&mtpt->port, status & UART_MSR_DCD); if (status & UART_MSR_DCTS) sb_uart_handle_cts_change(&mtpt->port, status & UART_MSR_CTS); wake_up_interruptible(&mtpt->port.info->delta_msr_wait); }
+Info
0
static _INLINE_ void check_modem_status(struct mp_port *mtpt) { int status; status = serial_in(mtpt, UART_MSR); if ((status & UART_MSR_ANY_DELTA) == 0) return; if (status & UART_MSR_TERI) mtpt->port.icount.rng++; if (status & UART_MSR_DDSR) mtpt->port.icount.dsr++; if (status & UART_MSR_DDCD) sb_uart_handle_dcd_change(&mtpt->port, status & UART_MSR_DCD); if (status & UART_MSR_DCTS) sb_uart_handle_cts_change(&mtpt->port, status & UART_MSR_CTS); wake_up_interruptible(&mtpt->port.info->delta_msr_wait); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,512
static int get_device_type(int arg) { int ret; ret = inb(mp_devs[arg].option_reg_addr+MP_OPTR_DIR0); ret = (ret & 0xf0) >> 4; switch (ret) { case DIR_UART_16C550: return PORT_16C55X; case DIR_UART_16C1050: return PORT_16C105X; case DIR_UART_16C1050A: /* if (mtpt->port.line < 2) { return PORT_16C105XA; } else { if (mtpt->device->device_id & 0x50) { return PORT_16C55X; } else { return PORT_16C105X; } }*/ return PORT_16C105XA; default: return PORT_UNKNOWN; } }
+Info
0
static int get_device_type(int arg) { int ret; ret = inb(mp_devs[arg].option_reg_addr+MP_OPTR_DIR0); ret = (ret & 0xf0) >> 4; switch (ret) { case DIR_UART_16C550: return PORT_16C55X; case DIR_UART_16C1050: return PORT_16C105X; case DIR_UART_16C1050A: /* if (mtpt->port.line < 2) { return PORT_16C105XA; } else { if (mtpt->device->device_id & 0x50) { return PORT_16C55X; } else { return PORT_16C105X; } }*/ return PORT_16C105XA; default: return PORT_UNKNOWN; } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,513
static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd) { static struct mp_device_t *sbdev = mp_devs; unsigned long addr = 0; int j; struct resource *ret = NULL; sbdev->device_id = brd.device_id; pci_read_config_byte(pcidev, PCI_CLASS_REVISION, &(sbdev->revision)); sbdev->name = brd.name; sbdev->uart_access_addr = pcidev->resource[0].start & PCI_BASE_ADDRESS_IO_MASK; /* check revision. The SB16C1053APCI's option i/o address is BAR4 */ if (sbdev->revision == 0xc0) { /* SB16C1053APCI */ sbdev->option_reg_addr = pcidev->resource[4].start & PCI_BASE_ADDRESS_IO_MASK; } else { sbdev->option_reg_addr = pcidev->resource[1].start & PCI_BASE_ADDRESS_IO_MASK; } #if 1 if (sbdev->revision == 0xc0) { outb(0x00, sbdev->option_reg_addr + MP_OPTR_GPOCR); inb(sbdev->option_reg_addr + MP_OPTR_GPOCR); outb(0x83, sbdev->option_reg_addr + MP_OPTR_GPOCR); } #endif sbdev->irq = pcidev->irq; if ((brd.device_id & 0x0800) || !(brd.device_id &0xff00)) { sbdev->poll_type = TYPE_INTERRUPT; } else { sbdev->poll_type = TYPE_POLL; } /* codes which is specific to each board*/ switch(brd.device_id){ case PCI_DEVICE_ID_MP1 : case PCIE_DEVICE_ID_MP1 : case PCIE_DEVICE_ID_MP1E : case PCIE_DEVICE_ID_GT_MP1 : sbdev->nr_ports = 1; break; case PCI_DEVICE_ID_MP2 : case PCIE_DEVICE_ID_MP2 : case PCIE_DEVICE_ID_GT_MP2 : case PCIE_DEVICE_ID_MP2B : case PCIE_DEVICE_ID_MP2E : sbdev->nr_ports = 2; /* serial base address remap */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); } break; case PCI_DEVICE_ID_MP4 : case PCI_DEVICE_ID_MP4A : case PCIE_DEVICE_ID_MP4 : case PCI_DEVICE_ID_GT_MP4 : case PCI_DEVICE_ID_GT_MP4A : case PCIE_DEVICE_ID_GT_MP4 : case PCI_DEVICE_ID_MP4M : case PCIE_DEVICE_ID_MP4B : sbdev->nr_ports = 4; if(sbdev->revision == 0x91){ sbdev->reserved_addr[0] = pcidev->resource[0].start & PCI_BASE_ADDRESS_IO_MASK; outb(0x03 , sbdev->reserved_addr[0] + 0x01); outb(0x03 , sbdev->reserved_addr[0] + 0x02); outb(0x01 , sbdev->reserved_addr[0] + 0x20); outb(0x00 , sbdev->reserved_addr[0] + 0x21); request_region(sbdev->reserved_addr[0], 32, sbdev->name); sbdev->uart_access_addr = pcidev->resource[1].start & PCI_BASE_ADDRESS_IO_MASK; sbdev->option_reg_addr = pcidev->resource[2].start & PCI_BASE_ADDRESS_IO_MASK; } /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_2, prev_port_addr + 16, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_3, prev_port_addr + 24, 8); } break; case PCI_DEVICE_ID_MP6 : case PCI_DEVICE_ID_MP6A : case PCI_DEVICE_ID_GT_MP6 : case PCI_DEVICE_ID_GT_MP6A : sbdev->nr_ports = 6; /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_2, prev_port_addr + 16, 16); pci_remap_base(pcidev, PCI_BASE_ADDRESS_3, prev_port_addr + 32, 16); } break; case PCI_DEVICE_ID_MP8 : case PCIE_DEVICE_ID_MP8 : case PCI_DEVICE_ID_GT_MP8 : case PCIE_DEVICE_ID_GT_MP8 : case PCIE_DEVICE_ID_MP8B : sbdev->nr_ports = 8; break; case PCI_DEVICE_ID_MP32 : case PCIE_DEVICE_ID_MP32 : case PCI_DEVICE_ID_GT_MP32 : case PCIE_DEVICE_ID_GT_MP32 : { int portnum_hex=0; portnum_hex = inb(sbdev->option_reg_addr); sbdev->nr_ports = ((portnum_hex/16)*10) + (portnum_hex % 16); } break; #ifdef CONFIG_PARPORT_PC case PCI_DEVICE_ID_MP2S1P : sbdev->nr_ports = 2; /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); } /* add PC compatible parallel port */ parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); break; case PCI_DEVICE_ID_MP1P : /* add PC compatible parallel port */ parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); break; #endif } ret = request_region(sbdev->uart_access_addr, (8*sbdev->nr_ports), sbdev->name); if (sbdev->revision == 0xc0) { ret = request_region(sbdev->option_reg_addr, 0x40, sbdev->name); } else { ret = request_region(sbdev->option_reg_addr, 0x20, sbdev->name); } NR_BOARD++; NR_PORTS += sbdev->nr_ports; /* Enable PCI interrupt */ addr = sbdev->option_reg_addr + MP_OPTR_IMR0; for(j=0; j < (sbdev->nr_ports/8)+1; j++) { if (sbdev->poll_type == TYPE_INTERRUPT) { outb(0xff,addr +j); } } sbdev++; return 0; }
+Info
0
static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd) { static struct mp_device_t *sbdev = mp_devs; unsigned long addr = 0; int j; struct resource *ret = NULL; sbdev->device_id = brd.device_id; pci_read_config_byte(pcidev, PCI_CLASS_REVISION, &(sbdev->revision)); sbdev->name = brd.name; sbdev->uart_access_addr = pcidev->resource[0].start & PCI_BASE_ADDRESS_IO_MASK; /* check revision. The SB16C1053APCI's option i/o address is BAR4 */ if (sbdev->revision == 0xc0) { /* SB16C1053APCI */ sbdev->option_reg_addr = pcidev->resource[4].start & PCI_BASE_ADDRESS_IO_MASK; } else { sbdev->option_reg_addr = pcidev->resource[1].start & PCI_BASE_ADDRESS_IO_MASK; } #if 1 if (sbdev->revision == 0xc0) { outb(0x00, sbdev->option_reg_addr + MP_OPTR_GPOCR); inb(sbdev->option_reg_addr + MP_OPTR_GPOCR); outb(0x83, sbdev->option_reg_addr + MP_OPTR_GPOCR); } #endif sbdev->irq = pcidev->irq; if ((brd.device_id & 0x0800) || !(brd.device_id &0xff00)) { sbdev->poll_type = TYPE_INTERRUPT; } else { sbdev->poll_type = TYPE_POLL; } /* codes which is specific to each board*/ switch(brd.device_id){ case PCI_DEVICE_ID_MP1 : case PCIE_DEVICE_ID_MP1 : case PCIE_DEVICE_ID_MP1E : case PCIE_DEVICE_ID_GT_MP1 : sbdev->nr_ports = 1; break; case PCI_DEVICE_ID_MP2 : case PCIE_DEVICE_ID_MP2 : case PCIE_DEVICE_ID_GT_MP2 : case PCIE_DEVICE_ID_MP2B : case PCIE_DEVICE_ID_MP2E : sbdev->nr_ports = 2; /* serial base address remap */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); } break; case PCI_DEVICE_ID_MP4 : case PCI_DEVICE_ID_MP4A : case PCIE_DEVICE_ID_MP4 : case PCI_DEVICE_ID_GT_MP4 : case PCI_DEVICE_ID_GT_MP4A : case PCIE_DEVICE_ID_GT_MP4 : case PCI_DEVICE_ID_MP4M : case PCIE_DEVICE_ID_MP4B : sbdev->nr_ports = 4; if(sbdev->revision == 0x91){ sbdev->reserved_addr[0] = pcidev->resource[0].start & PCI_BASE_ADDRESS_IO_MASK; outb(0x03 , sbdev->reserved_addr[0] + 0x01); outb(0x03 , sbdev->reserved_addr[0] + 0x02); outb(0x01 , sbdev->reserved_addr[0] + 0x20); outb(0x00 , sbdev->reserved_addr[0] + 0x21); request_region(sbdev->reserved_addr[0], 32, sbdev->name); sbdev->uart_access_addr = pcidev->resource[1].start & PCI_BASE_ADDRESS_IO_MASK; sbdev->option_reg_addr = pcidev->resource[2].start & PCI_BASE_ADDRESS_IO_MASK; } /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_2, prev_port_addr + 16, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_3, prev_port_addr + 24, 8); } break; case PCI_DEVICE_ID_MP6 : case PCI_DEVICE_ID_MP6A : case PCI_DEVICE_ID_GT_MP6 : case PCI_DEVICE_ID_GT_MP6A : sbdev->nr_ports = 6; /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); pci_remap_base(pcidev, PCI_BASE_ADDRESS_2, prev_port_addr + 16, 16); pci_remap_base(pcidev, PCI_BASE_ADDRESS_3, prev_port_addr + 32, 16); } break; case PCI_DEVICE_ID_MP8 : case PCIE_DEVICE_ID_MP8 : case PCI_DEVICE_ID_GT_MP8 : case PCIE_DEVICE_ID_GT_MP8 : case PCIE_DEVICE_ID_MP8B : sbdev->nr_ports = 8; break; case PCI_DEVICE_ID_MP32 : case PCIE_DEVICE_ID_MP32 : case PCI_DEVICE_ID_GT_MP32 : case PCIE_DEVICE_ID_GT_MP32 : { int portnum_hex=0; portnum_hex = inb(sbdev->option_reg_addr); sbdev->nr_ports = ((portnum_hex/16)*10) + (portnum_hex % 16); } break; #ifdef CONFIG_PARPORT_PC case PCI_DEVICE_ID_MP2S1P : sbdev->nr_ports = 2; /* SB16C1053APCI */ if (sbdev->revision == 0xc0) { int prev_port_addr = 0; pci_read_config_dword(pcidev, PCI_BASE_ADDRESS_0, &prev_port_addr); pci_remap_base(pcidev, PCI_BASE_ADDRESS_1, prev_port_addr + 8, 8); } /* add PC compatible parallel port */ parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); break; case PCI_DEVICE_ID_MP1P : /* add PC compatible parallel port */ parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); break; #endif } ret = request_region(sbdev->uart_access_addr, (8*sbdev->nr_ports), sbdev->name); if (sbdev->revision == 0xc0) { ret = request_region(sbdev->option_reg_addr, 0x40, sbdev->name); } else { ret = request_region(sbdev->option_reg_addr, 0x20, sbdev->name); } NR_BOARD++; NR_PORTS += sbdev->nr_ports; /* Enable PCI interrupt */ addr = sbdev->option_reg_addr + MP_OPTR_IMR0; for(j=0; j < (sbdev->nr_ports/8)+1; j++) { if (sbdev->poll_type == TYPE_INTERRUPT) { outb(0xff,addr +j); } } sbdev++; return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,514
static int mp_add_one_port(struct uart_driver *drv, struct sb_uart_port *port) { struct sb_uart_state *state; int ret = 0; if (port->line >= drv->nr) return -EINVAL; state = drv->state + port->line; MP_MUTEX_LOCK(mp_mutex); if (state->port) { ret = -EINVAL; goto out; } state->port = port; spin_lock_init(&port->lock); port->cons = drv->cons; port->info = state->info; mp_configure_port(drv, state, port); tty_register_device(drv->tty_driver, port->line, port->dev); out: MP_MUTEX_UNLOCK(mp_mutex); return ret; }
+Info
0
static int mp_add_one_port(struct uart_driver *drv, struct sb_uart_port *port) { struct sb_uart_state *state; int ret = 0; if (port->line >= drv->nr) return -EINVAL; state = drv->state + port->line; MP_MUTEX_LOCK(mp_mutex); if (state->port) { ret = -EINVAL; goto out; } state->port = port; spin_lock_init(&port->lock); port->cons = drv->cons; port->info = state->info; mp_configure_port(drv, state, port); tty_register_device(drv->tty_driver, port->line, port->dev); out: MP_MUTEX_UNLOCK(mp_mutex); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,515
static int mp_block_til_ready(struct file *filp, struct sb_uart_state *state) { DECLARE_WAITQUEUE(wait, current); struct sb_uart_info *info = state->info; struct sb_uart_port *port = state->port; unsigned int mctrl; info->blocked_open++; state->count--; add_wait_queue(&info->open_wait, &wait); while (1) { set_current_state(TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || info->tty == NULL) break; if (!(info->flags & UIF_INITIALIZED)) break; if ((filp->f_flags & O_NONBLOCK) || (info->tty->termios.c_cflag & CLOCAL) || (info->tty->flags & (1 << TTY_IO_ERROR))) { break; } if (info->tty->termios.c_cflag & CBAUD) uart_set_mctrl(port, TIOCM_DTR); spin_lock_irq(&port->lock); port->ops->enable_ms(port); mctrl = port->ops->get_mctrl(port); spin_unlock_irq(&port->lock); if (mctrl & TIOCM_CAR) break; MP_STATE_UNLOCK(state); schedule(); MP_STATE_LOCK(state); if (signal_pending(current)) break; } set_current_state(TASK_RUNNING); remove_wait_queue(&info->open_wait, &wait); state->count++; info->blocked_open--; if (signal_pending(current)) return -ERESTARTSYS; if (!info->tty || tty_hung_up_p(filp)) return -EAGAIN; return 0; }
+Info
0
static int mp_block_til_ready(struct file *filp, struct sb_uart_state *state) { DECLARE_WAITQUEUE(wait, current); struct sb_uart_info *info = state->info; struct sb_uart_port *port = state->port; unsigned int mctrl; info->blocked_open++; state->count--; add_wait_queue(&info->open_wait, &wait); while (1) { set_current_state(TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || info->tty == NULL) break; if (!(info->flags & UIF_INITIALIZED)) break; if ((filp->f_flags & O_NONBLOCK) || (info->tty->termios.c_cflag & CLOCAL) || (info->tty->flags & (1 << TTY_IO_ERROR))) { break; } if (info->tty->termios.c_cflag & CBAUD) uart_set_mctrl(port, TIOCM_DTR); spin_lock_irq(&port->lock); port->ops->enable_ms(port); mctrl = port->ops->get_mctrl(port); spin_unlock_irq(&port->lock); if (mctrl & TIOCM_CAR) break; MP_STATE_UNLOCK(state); schedule(); MP_STATE_LOCK(state); if (signal_pending(current)) break; } set_current_state(TASK_RUNNING); remove_wait_queue(&info->open_wait, &wait); state->count++; info->blocked_open--; if (signal_pending(current)) return -ERESTARTSYS; if (!info->tty || tty_hung_up_p(filp)) return -EAGAIN; return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,516
static void mp_change_pm(struct sb_uart_state *state, int pm_state) { struct sb_uart_port *port = state->port; if (port->ops->pm) port->ops->pm(port, pm_state, state->pm_state); state->pm_state = pm_state; }
+Info
0
static void mp_change_pm(struct sb_uart_state *state, int pm_state) { struct sb_uart_port *port = state->port; if (port->ops->pm) port->ops->pm(port, pm_state, state->pm_state); state->pm_state = pm_state; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,517
static int mp_chars_in_buffer(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; return uart_circ_chars_pending(&state->info->xmit); }
+Info
0
static int mp_chars_in_buffer(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; return uart_circ_chars_pending(&state->info->xmit); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,518
static void mp_close(struct tty_struct *tty, struct file *filp) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; printk("mp_close!\n"); if (!state || !state->port) return; port = state->port; printk("close1 %d\n", __LINE__); MP_STATE_LOCK(state); printk("close2 %d\n", __LINE__); if (tty_hung_up_p(filp)) goto done; printk("close3 %d\n", __LINE__); if ((tty->count == 1) && (state->count != 1)) { printk("mp_close: bad serial port count; tty->count is 1, " "state->count is %d\n", state->count); state->count = 1; } printk("close4 %d\n", __LINE__); if (--state->count < 0) { printk("rs_close: bad serial port count for ttyMP%d: %d\n", port->line, state->count); state->count = 0; } if (state->count) goto done; tty->closing = 1; printk("close5 %d\n", __LINE__); if (state->closing_wait != USF_CLOSING_WAIT_NONE) tty_wait_until_sent(tty, state->closing_wait); printk("close6 %d\n", __LINE__); if (state->info->flags & UIF_INITIALIZED) { unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->ops->stop_rx(port); spin_unlock_irqrestore(&port->lock, flags); mp_wait_until_sent(tty, port->timeout); } printk("close7 %d\n", __LINE__); mp_shutdown(state); printk("close8 %d\n", __LINE__); mp_flush_buffer(tty); tty_ldisc_flush(tty); tty->closing = 0; state->info->tty = NULL; if (state->info->blocked_open) { if (state->close_delay) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(state->close_delay); } } else { mp_change_pm(state, 3); } printk("close8 %d\n", __LINE__); state->info->flags &= ~UIF_NORMAL_ACTIVE; wake_up_interruptible(&state->info->open_wait); done: printk("close done\n"); MP_STATE_UNLOCK(state); module_put(THIS_MODULE); }
+Info
0
static void mp_close(struct tty_struct *tty, struct file *filp) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; printk("mp_close!\n"); if (!state || !state->port) return; port = state->port; printk("close1 %d\n", __LINE__); MP_STATE_LOCK(state); printk("close2 %d\n", __LINE__); if (tty_hung_up_p(filp)) goto done; printk("close3 %d\n", __LINE__); if ((tty->count == 1) && (state->count != 1)) { printk("mp_close: bad serial port count; tty->count is 1, " "state->count is %d\n", state->count); state->count = 1; } printk("close4 %d\n", __LINE__); if (--state->count < 0) { printk("rs_close: bad serial port count for ttyMP%d: %d\n", port->line, state->count); state->count = 0; } if (state->count) goto done; tty->closing = 1; printk("close5 %d\n", __LINE__); if (state->closing_wait != USF_CLOSING_WAIT_NONE) tty_wait_until_sent(tty, state->closing_wait); printk("close6 %d\n", __LINE__); if (state->info->flags & UIF_INITIALIZED) { unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->ops->stop_rx(port); spin_unlock_irqrestore(&port->lock, flags); mp_wait_until_sent(tty, port->timeout); } printk("close7 %d\n", __LINE__); mp_shutdown(state); printk("close8 %d\n", __LINE__); mp_flush_buffer(tty); tty_ldisc_flush(tty); tty->closing = 0; state->info->tty = NULL; if (state->info->blocked_open) { if (state->close_delay) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(state->close_delay); } } else { mp_change_pm(state, 3); } printk("close8 %d\n", __LINE__); state->info->flags &= ~UIF_NORMAL_ACTIVE; wake_up_interruptible(&state->info->open_wait); done: printk("close done\n"); MP_STATE_UNLOCK(state); module_put(THIS_MODULE); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,519
static void mp_configure_port(struct uart_driver *drv, struct sb_uart_state *state, struct sb_uart_port *port) { unsigned int flags; if (!port->iobase && !port->mapbase && !port->membase) { DPRINTK("%s error \n",__FUNCTION__); return; } flags = UART_CONFIG_TYPE; if (port->flags & UPF_AUTO_IRQ) flags |= UART_CONFIG_IRQ; if (port->flags & UPF_BOOT_AUTOCONF) { port->type = PORT_UNKNOWN; port->ops->config_port(port, flags); } if (port->type != PORT_UNKNOWN) { unsigned long flags; mp_report_port(drv, port); spin_lock_irqsave(&port->lock, flags); port->ops->set_mctrl(port, 0); spin_unlock_irqrestore(&port->lock, flags); mp_change_pm(state, 3); } }
+Info
0
static void mp_configure_port(struct uart_driver *drv, struct sb_uart_state *state, struct sb_uart_port *port) { unsigned int flags; if (!port->iobase && !port->mapbase && !port->membase) { DPRINTK("%s error \n",__FUNCTION__); return; } flags = UART_CONFIG_TYPE; if (port->flags & UPF_AUTO_IRQ) flags |= UART_CONFIG_IRQ; if (port->flags & UPF_BOOT_AUTOCONF) { port->type = PORT_UNKNOWN; port->ops->config_port(port, flags); } if (port->type != PORT_UNKNOWN) { unsigned long flags; mp_report_port(drv, port); spin_lock_irqsave(&port->lock, flags); port->ops->set_mctrl(port, 0); spin_unlock_irqrestore(&port->lock, flags); mp_change_pm(state, 3); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,520
static int mp_do_autoconfig(struct sb_uart_state *state) { struct sb_uart_port *port = state->port; int flags, ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (mutex_lock_interruptible(&state->mutex)) return -ERESTARTSYS; ret = -EBUSY; if (uart_users(state) == 1) { mp_shutdown(state); if (port->type != PORT_UNKNOWN) port->ops->release_port(port); flags = UART_CONFIG_TYPE; if (port->flags & UPF_AUTO_IRQ) flags |= UART_CONFIG_IRQ; port->ops->config_port(port, flags); ret = mp_startup(state, 1); } MP_STATE_UNLOCK(state); return ret; }
+Info
0
static int mp_do_autoconfig(struct sb_uart_state *state) { struct sb_uart_port *port = state->port; int flags, ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (mutex_lock_interruptible(&state->mutex)) return -ERESTARTSYS; ret = -EBUSY; if (uart_users(state) == 1) { mp_shutdown(state); if (port->type != PORT_UNKNOWN) port->ops->release_port(port); flags = UART_CONFIG_TYPE; if (port->flags & UPF_AUTO_IRQ) flags |= UART_CONFIG_IRQ; port->ops->config_port(port, flags); ret = mp_startup(state, 1); } MP_STATE_UNLOCK(state); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,521
static void mp_flush_buffer(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; unsigned long flags; if (!state || !state->info) { return; } port = state->port; spin_lock_irqsave(&port->lock, flags); uart_circ_clear(&state->info->xmit); spin_unlock_irqrestore(&port->lock, flags); wake_up_interruptible(&tty->write_wait); tty_wakeup(tty); }
+Info
0
static void mp_flush_buffer(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; unsigned long flags; if (!state || !state->info) { return; } port = state->port; spin_lock_irqsave(&port->lock, flags); uart_circ_clear(&state->info->xmit); spin_unlock_irqrestore(&port->lock, flags); wake_up_interruptible(&tty->write_wait); tty_wakeup(tty); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,522
static int mp_get_info(struct sb_uart_state *state, struct serial_struct *retinfo) { struct sb_uart_port *port = state->port; struct serial_struct tmp; memset(&tmp, 0, sizeof(tmp)); tmp.type = port->type; tmp.line = port->line; tmp.port = port->iobase; if (HIGH_BITS_OFFSET) tmp.port_high = (long) port->iobase >> HIGH_BITS_OFFSET; tmp.irq = port->irq; tmp.flags = port->flags; tmp.xmit_fifo_size = port->fifosize; tmp.baud_base = port->uartclk / 16; tmp.close_delay = state->close_delay; tmp.closing_wait = state->closing_wait == USF_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : state->closing_wait; tmp.custom_divisor = port->custom_divisor; tmp.hub6 = port->hub6; tmp.io_type = port->iotype; tmp.iomem_reg_shift = port->regshift; tmp.iomem_base = (void *)port->mapbase; if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) return -EFAULT; return 0; }
+Info
0
static int mp_get_info(struct sb_uart_state *state, struct serial_struct *retinfo) { struct sb_uart_port *port = state->port; struct serial_struct tmp; memset(&tmp, 0, sizeof(tmp)); tmp.type = port->type; tmp.line = port->line; tmp.port = port->iobase; if (HIGH_BITS_OFFSET) tmp.port_high = (long) port->iobase >> HIGH_BITS_OFFSET; tmp.irq = port->irq; tmp.flags = port->flags; tmp.xmit_fifo_size = port->fifosize; tmp.baud_base = port->uartclk / 16; tmp.close_delay = state->close_delay; tmp.closing_wait = state->closing_wait == USF_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : state->closing_wait; tmp.custom_divisor = port->custom_divisor; tmp.hub6 = port->hub6; tmp.io_type = port->iotype; tmp.iomem_reg_shift = port->regshift; tmp.iomem_base = (void *)port->mapbase; if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) return -EFAULT; return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,523
static int mp_get_lsr_info(struct sb_uart_state *state, unsigned int *value) { struct sb_uart_port *port = state->port; unsigned int result; result = port->ops->tx_empty(port); if (port->x_char || ((uart_circ_chars_pending(&state->info->xmit) > 0) && !state->info->tty->stopped && !state->info->tty->hw_stopped)) result &= ~TIOCSER_TEMT; return put_user(result, value); }
+Info
0
static int mp_get_lsr_info(struct sb_uart_state *state, unsigned int *value) { struct sb_uart_port *port = state->port; unsigned int result; result = port->ops->tx_empty(port); if (port->x_char || ((uart_circ_chars_pending(&state->info->xmit) > 0) && !state->info->tty->stopped && !state->info->tty->hw_stopped)) result &= ~TIOCSER_TEMT; return put_user(result, value); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,524
static void mp_hangup(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; MP_STATE_LOCK(state); if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { mp_flush_buffer(tty); mp_shutdown(state); state->count = 0; state->info->flags &= ~UIF_NORMAL_ACTIVE; state->info->tty = NULL; wake_up_interruptible(&state->info->open_wait); wake_up_interruptible(&state->info->delta_msr_wait); } MP_STATE_UNLOCK(state); }
+Info
0
static void mp_hangup(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; MP_STATE_LOCK(state); if (state->info && state->info->flags & UIF_NORMAL_ACTIVE) { mp_flush_buffer(tty); mp_shutdown(state); state->count = 0; state->info->flags &= ~UIF_NORMAL_ACTIVE; state->info->tty = NULL; wake_up_interruptible(&state->info->open_wait); wake_up_interruptible(&state->info->delta_msr_wait); } MP_STATE_UNLOCK(state); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,525
static int mp_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct sb_uart_state *state = tty->driver_data; struct mp_port *info = (struct mp_port *)state->port; int ret = -ENOIOCTLCMD; switch (cmd) { case TIOCSMULTIDROP: /* set multi-drop mode enable or disable, and default operation mode is H/W mode */ if (info->port.type == PORT_16C105XA) { return set_multidrop_mode((struct sb_uart_port *)info, (unsigned int)arg); } ret = -ENOTSUPP; break; case GETDEEPFIFO: ret = get_deep_fifo(state->port); return ret; case SETDEEPFIFO: ret = set_deep_fifo(state->port,arg); deep[state->port->line] = arg; return ret; case SETTTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_4,SB105X_TTR,arg); ttr[state->port->line] = arg; } return ret; case SETRTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_4,SB105X_RTR,arg); rtr[state->port->line] = arg; } return ret; case GETTTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_get_register(state->port,PAGE_4,SB105X_TTR); } return ret; case GETRTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_get_register(state->port,PAGE_4,SB105X_RTR); } return ret; case SETFCR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_1,SB105X_FCR,arg); } else{ serial_out(info,2,arg); } return ret; case TIOCSMDADDR: /* set multi-drop address */ if (info->port.type == PORT_16C105XA) { state->port->mdmode |= MDMODE_ADDR; return set_multidrop_addr((struct sb_uart_port *)info, (unsigned int)arg); } ret = -ENOTSUPP; break; case TIOCGMDADDR: /* set multi-drop address */ if ((info->port.type == PORT_16C105XA) && (state->port->mdmode & MDMODE_ADDR)) { return get_multidrop_addr((struct sb_uart_port *)info); } ret = -ENOTSUPP; break; case TIOCSENDADDR: /* send address in multi-drop mode */ if ((info->port.type == PORT_16C105XA) && (state->port->mdmode & (MDMODE_ENABLE))) { if (mp_chars_in_buffer(tty) > 0) { tty_wait_until_sent(tty, 0); } while ((serial_in(info, UART_LSR) & 0x60) != 0x60); serial_out(info, UART_SCR, (int)arg); } break; case TIOCGSERIAL: ret = mp_get_info(state, (struct serial_struct *)arg); break; case TIOCSSERIAL: ret = mp_set_info(state, (struct serial_struct *)arg); break; case TIOCSERCONFIG: ret = mp_do_autoconfig(state); break; case TIOCSERGWILD: /* obsolete */ case TIOCSERSWILD: /* obsolete */ ret = 0; break; /* for Multiport */ case TIOCGNUMOFPORT: /* Get number of ports */ return NR_PORTS; case TIOCGGETDEVID: return mp_devs[arg].device_id; case TIOCGGETREV: return mp_devs[arg].revision; case TIOCGGETNRPORTS: return mp_devs[arg].nr_ports; case TIOCGGETBDNO: return NR_BOARD; case TIOCGGETINTERFACE: if (mp_devs[arg].revision == 0xc0) { /* for SB16C1053APCI */ return (sb1053a_get_interface(info, info->port.line)); } else { return (inb(mp_devs[arg].option_reg_addr+MP_OPTR_IIR0+(state->port->line/8))); } case TIOCGGETPORTTYPE: ret = get_device_type(arg);; return ret; case TIOCSMULTIECHO: /* set to multi-drop mode(RS422) or echo mode(RS485)*/ outb( ( inb(info->interface_config_addr) & ~0x03 ) | 0x01 , info->interface_config_addr); return 0; case TIOCSPTPNOECHO: /* set to multi-drop mode(RS422) or echo mode(RS485) */ outb( ( inb(info->interface_config_addr) & ~0x03 ) , info->interface_config_addr); return 0; } if (ret != -ENOIOCTLCMD) goto out; if (tty->flags & (1 << TTY_IO_ERROR)) { ret = -EIO; goto out; } switch (cmd) { case TIOCMIWAIT: ret = mp_wait_modem_status(state, arg); break; case TIOCGICOUNT: ret = mp_get_count(state, (struct serial_icounter_struct *)arg); break; } if (ret != -ENOIOCTLCMD) goto out; MP_STATE_LOCK(state); switch (cmd) { case TIOCSERGETLSR: /* Get line status register */ ret = mp_get_lsr_info(state, (unsigned int *)arg); break; default: { struct sb_uart_port *port = state->port; if (port->ops->ioctl) ret = port->ops->ioctl(port, cmd, arg); break; } } MP_STATE_UNLOCK(state); out: return ret; }
+Info
0
static int mp_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct sb_uart_state *state = tty->driver_data; struct mp_port *info = (struct mp_port *)state->port; int ret = -ENOIOCTLCMD; switch (cmd) { case TIOCSMULTIDROP: /* set multi-drop mode enable or disable, and default operation mode is H/W mode */ if (info->port.type == PORT_16C105XA) { return set_multidrop_mode((struct sb_uart_port *)info, (unsigned int)arg); } ret = -ENOTSUPP; break; case GETDEEPFIFO: ret = get_deep_fifo(state->port); return ret; case SETDEEPFIFO: ret = set_deep_fifo(state->port,arg); deep[state->port->line] = arg; return ret; case SETTTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_4,SB105X_TTR,arg); ttr[state->port->line] = arg; } return ret; case SETRTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_4,SB105X_RTR,arg); rtr[state->port->line] = arg; } return ret; case GETTTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_get_register(state->port,PAGE_4,SB105X_TTR); } return ret; case GETRTR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_get_register(state->port,PAGE_4,SB105X_RTR); } return ret; case SETFCR: if (info->port.type == PORT_16C105X || info->port.type == PORT_16C105XA){ ret = sb1054_set_register(state->port,PAGE_1,SB105X_FCR,arg); } else{ serial_out(info,2,arg); } return ret; case TIOCSMDADDR: /* set multi-drop address */ if (info->port.type == PORT_16C105XA) { state->port->mdmode |= MDMODE_ADDR; return set_multidrop_addr((struct sb_uart_port *)info, (unsigned int)arg); } ret = -ENOTSUPP; break; case TIOCGMDADDR: /* set multi-drop address */ if ((info->port.type == PORT_16C105XA) && (state->port->mdmode & MDMODE_ADDR)) { return get_multidrop_addr((struct sb_uart_port *)info); } ret = -ENOTSUPP; break; case TIOCSENDADDR: /* send address in multi-drop mode */ if ((info->port.type == PORT_16C105XA) && (state->port->mdmode & (MDMODE_ENABLE))) { if (mp_chars_in_buffer(tty) > 0) { tty_wait_until_sent(tty, 0); } while ((serial_in(info, UART_LSR) & 0x60) != 0x60); serial_out(info, UART_SCR, (int)arg); } break; case TIOCGSERIAL: ret = mp_get_info(state, (struct serial_struct *)arg); break; case TIOCSSERIAL: ret = mp_set_info(state, (struct serial_struct *)arg); break; case TIOCSERCONFIG: ret = mp_do_autoconfig(state); break; case TIOCSERGWILD: /* obsolete */ case TIOCSERSWILD: /* obsolete */ ret = 0; break; /* for Multiport */ case TIOCGNUMOFPORT: /* Get number of ports */ return NR_PORTS; case TIOCGGETDEVID: return mp_devs[arg].device_id; case TIOCGGETREV: return mp_devs[arg].revision; case TIOCGGETNRPORTS: return mp_devs[arg].nr_ports; case TIOCGGETBDNO: return NR_BOARD; case TIOCGGETINTERFACE: if (mp_devs[arg].revision == 0xc0) { /* for SB16C1053APCI */ return (sb1053a_get_interface(info, info->port.line)); } else { return (inb(mp_devs[arg].option_reg_addr+MP_OPTR_IIR0+(state->port->line/8))); } case TIOCGGETPORTTYPE: ret = get_device_type(arg);; return ret; case TIOCSMULTIECHO: /* set to multi-drop mode(RS422) or echo mode(RS485)*/ outb( ( inb(info->interface_config_addr) & ~0x03 ) | 0x01 , info->interface_config_addr); return 0; case TIOCSPTPNOECHO: /* set to multi-drop mode(RS422) or echo mode(RS485) */ outb( ( inb(info->interface_config_addr) & ~0x03 ) , info->interface_config_addr); return 0; } if (ret != -ENOIOCTLCMD) goto out; if (tty->flags & (1 << TTY_IO_ERROR)) { ret = -EIO; goto out; } switch (cmd) { case TIOCMIWAIT: ret = mp_wait_modem_status(state, arg); break; case TIOCGICOUNT: ret = mp_get_count(state, (struct serial_icounter_struct *)arg); break; } if (ret != -ENOIOCTLCMD) goto out; MP_STATE_LOCK(state); switch (cmd) { case TIOCSERGETLSR: /* Get line status register */ ret = mp_get_lsr_info(state, (unsigned int *)arg); break; default: { struct sb_uart_port *port = state->port; if (port->ops->ioctl) ret = port->ops->ioctl(port, cmd, arg); break; } } MP_STATE_UNLOCK(state); out: return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,526
static int mp_put_char(struct tty_struct *tty, unsigned char ch) { struct sb_uart_state *state = tty->driver_data; return __mp_put_char(state->port, &state->info->xmit, ch); }
+Info
0
static int mp_put_char(struct tty_struct *tty, unsigned char ch) { struct sb_uart_state *state = tty->driver_data; return __mp_put_char(state->port, &state->info->xmit, ch); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,527
static void mp_put_chars(struct tty_struct *tty) { mp_start(tty); }
+Info
0
static void mp_put_chars(struct tty_struct *tty) { mp_start(tty); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,528
static int mp_register_driver(struct uart_driver *drv) { struct tty_driver *normal = NULL; int i, retval; drv->state = kmalloc(sizeof(struct sb_uart_state) * drv->nr, GFP_KERNEL); retval = -ENOMEM; if (!drv->state) { printk("SB PCI Error: Kernel memory allocation error!\n"); goto out; } memset(drv->state, 0, sizeof(struct sb_uart_state) * drv->nr); normal = alloc_tty_driver(drv->nr); if (!normal) { printk("SB PCI Error: tty allocation error!\n"); goto out; } drv->tty_driver = normal; normal->owner = drv->owner; normal->magic = TTY_DRIVER_MAGIC; normal->driver_name = drv->driver_name; normal->name = drv->dev_name; normal->major = drv->major; normal->minor_start = drv->minor; normal->num = MAX_MP_PORT ; normal->type = TTY_DRIVER_TYPE_SERIAL; normal->subtype = SERIAL_TYPE_NORMAL; normal->init_termios = tty_std_termios; normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; normal->driver_state = drv; tty_set_operations(normal, &mp_ops); for (i = 0; i < drv->nr; i++) { struct sb_uart_state *state = drv->state + i; state->close_delay = 500; state->closing_wait = 30000; mutex_init(&state->mutex); } retval = tty_register_driver(normal); out: if (retval < 0) { printk("Register tty driver Fail!\n"); put_tty_driver(normal); kfree(drv->state); } return retval; }
+Info
0
static int mp_register_driver(struct uart_driver *drv) { struct tty_driver *normal = NULL; int i, retval; drv->state = kmalloc(sizeof(struct sb_uart_state) * drv->nr, GFP_KERNEL); retval = -ENOMEM; if (!drv->state) { printk("SB PCI Error: Kernel memory allocation error!\n"); goto out; } memset(drv->state, 0, sizeof(struct sb_uart_state) * drv->nr); normal = alloc_tty_driver(drv->nr); if (!normal) { printk("SB PCI Error: tty allocation error!\n"); goto out; } drv->tty_driver = normal; normal->owner = drv->owner; normal->magic = TTY_DRIVER_MAGIC; normal->driver_name = drv->driver_name; normal->name = drv->dev_name; normal->major = drv->major; normal->minor_start = drv->minor; normal->num = MAX_MP_PORT ; normal->type = TTY_DRIVER_TYPE_SERIAL; normal->subtype = SERIAL_TYPE_NORMAL; normal->init_termios = tty_std_termios; normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; normal->driver_state = drv; tty_set_operations(normal, &mp_ops); for (i = 0; i < drv->nr; i++) { struct sb_uart_state *state = drv->state + i; state->close_delay = 500; state->closing_wait = 30000; mutex_init(&state->mutex); } retval = tty_register_driver(normal); out: if (retval < 0) { printk("Register tty driver Fail!\n"); put_tty_driver(normal); kfree(drv->state); } return retval; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,529
static int mp_remove_one_port(struct uart_driver *drv, struct sb_uart_port *port) { struct sb_uart_state *state = drv->state + port->line; if (state->port != port) printk(KERN_ALERT "Removing wrong port: %p != %p\n", state->port, port); MP_MUTEX_LOCK(mp_mutex); tty_unregister_device(drv->tty_driver, port->line); mp_unconfigure_port(drv, state); state->port = NULL; MP_MUTEX_UNLOCK(mp_mutex); return 0; }
+Info
0
static int mp_remove_one_port(struct uart_driver *drv, struct sb_uart_port *port) { struct sb_uart_state *state = drv->state + port->line; if (state->port != port) printk(KERN_ALERT "Removing wrong port: %p != %p\n", state->port, port); MP_MUTEX_LOCK(mp_mutex); tty_unregister_device(drv->tty_driver, port->line); mp_unconfigure_port(drv, state); state->port = NULL; MP_MUTEX_UNLOCK(mp_mutex); return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,530
static inline void mp_report_port(struct uart_driver *drv, struct sb_uart_port *port) { char address[64]; switch (port->iotype) { case UPIO_PORT: snprintf(address, sizeof(address),"I/O 0x%x", port->iobase); break; case UPIO_HUB6: snprintf(address, sizeof(address),"I/O 0x%x offset 0x%x", port->iobase, port->hub6); break; case UPIO_MEM: snprintf(address, sizeof(address),"MMIO 0x%lx", port->mapbase); break; default: snprintf(address, sizeof(address),"*unknown*" ); strlcpy(address, "*unknown*", sizeof(address)); break; } printk( "%s%d at %s (irq = %d) is a %s\n", drv->dev_name, port->line, address, port->irq, mp_type(port)); }
+Info
0
static inline void mp_report_port(struct uart_driver *drv, struct sb_uart_port *port) { char address[64]; switch (port->iotype) { case UPIO_PORT: snprintf(address, sizeof(address),"I/O 0x%x", port->iobase); break; case UPIO_HUB6: snprintf(address, sizeof(address),"I/O 0x%x offset 0x%x", port->iobase, port->hub6); break; case UPIO_MEM: snprintf(address, sizeof(address),"MMIO 0x%lx", port->mapbase); break; default: snprintf(address, sizeof(address),"*unknown*" ); strlcpy(address, "*unknown*", sizeof(address)); break; } printk( "%s%d at %s (irq = %d) is a %s\n", drv->dev_name, port->line, address, port->irq, mp_type(port)); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,531
static int mp_set_info(struct sb_uart_state *state, struct serial_struct *newinfo) { struct serial_struct new_serial; struct sb_uart_port *port = state->port; unsigned long new_port; unsigned int change_irq, change_port, closing_wait; unsigned int old_custom_divisor; unsigned int old_flags, new_flags; int retval = 0; if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) return -EFAULT; new_port = new_serial.port; if (HIGH_BITS_OFFSET) new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET; new_serial.irq = irq_canonicalize(new_serial.irq); closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ? USF_CLOSING_WAIT_NONE : new_serial.closing_wait; MP_STATE_LOCK(state); change_irq = new_serial.irq != port->irq; change_port = new_port != port->iobase || (unsigned long)new_serial.iomem_base != port->mapbase || new_serial.hub6 != port->hub6 || new_serial.io_type != port->iotype || new_serial.iomem_reg_shift != port->regshift || new_serial.type != port->type; old_flags = port->flags; new_flags = new_serial.flags; old_custom_divisor = port->custom_divisor; if (!capable(CAP_SYS_ADMIN)) { retval = -EPERM; if (change_irq || change_port || (new_serial.baud_base != port->uartclk / 16) || (new_serial.close_delay != state->close_delay) || (closing_wait != state->closing_wait) || (new_serial.xmit_fifo_size != port->fifosize) || (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0)) goto exit; port->flags = ((port->flags & ~UPF_USR_MASK) | (new_flags & UPF_USR_MASK)); port->custom_divisor = new_serial.custom_divisor; goto check_and_exit; } if (port->ops->verify_port) retval = port->ops->verify_port(port, &new_serial); if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || (new_serial.baud_base < 9600)) retval = -EINVAL; if (retval) goto exit; if (change_port || change_irq) { retval = -EBUSY; if (uart_users(state) > 1) goto exit; mp_shutdown(state); } if (change_port) { unsigned long old_iobase, old_mapbase; unsigned int old_type, old_iotype, old_hub6, old_shift; old_iobase = port->iobase; old_mapbase = port->mapbase; old_type = port->type; old_hub6 = port->hub6; old_iotype = port->iotype; old_shift = port->regshift; if (old_type != PORT_UNKNOWN) port->ops->release_port(port); port->iobase = new_port; port->type = new_serial.type; port->hub6 = new_serial.hub6; port->iotype = new_serial.io_type; port->regshift = new_serial.iomem_reg_shift; port->mapbase = (unsigned long)new_serial.iomem_base; if (port->type != PORT_UNKNOWN) { retval = port->ops->request_port(port); } else { retval = 0; } if (retval && old_type != PORT_UNKNOWN) { port->iobase = old_iobase; port->type = old_type; port->hub6 = old_hub6; port->iotype = old_iotype; port->regshift = old_shift; port->mapbase = old_mapbase; retval = port->ops->request_port(port); if (retval) port->type = PORT_UNKNOWN; retval = -EBUSY; } } port->irq = new_serial.irq; port->uartclk = new_serial.baud_base * 16; port->flags = (port->flags & ~UPF_CHANGE_MASK) | (new_flags & UPF_CHANGE_MASK); port->custom_divisor = new_serial.custom_divisor; state->close_delay = new_serial.close_delay; state->closing_wait = closing_wait; port->fifosize = new_serial.xmit_fifo_size; if (state->info->tty) state->info->tty->low_latency = (port->flags & UPF_LOW_LATENCY) ? 1 : 0; check_and_exit: retval = 0; if (port->type == PORT_UNKNOWN) goto exit; if (state->info->flags & UIF_INITIALIZED) { if (((old_flags ^ port->flags) & UPF_SPD_MASK) || old_custom_divisor != port->custom_divisor) { if (port->flags & UPF_SPD_MASK) { printk(KERN_NOTICE "%s sets custom speed on ttyMP%d. This " "is deprecated.\n", current->comm, port->line); } mp_change_speed(state, NULL); } } else retval = mp_startup(state, 1); exit: MP_STATE_UNLOCK(state); return retval; }
+Info
0
static int mp_set_info(struct sb_uart_state *state, struct serial_struct *newinfo) { struct serial_struct new_serial; struct sb_uart_port *port = state->port; unsigned long new_port; unsigned int change_irq, change_port, closing_wait; unsigned int old_custom_divisor; unsigned int old_flags, new_flags; int retval = 0; if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) return -EFAULT; new_port = new_serial.port; if (HIGH_BITS_OFFSET) new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET; new_serial.irq = irq_canonicalize(new_serial.irq); closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ? USF_CLOSING_WAIT_NONE : new_serial.closing_wait; MP_STATE_LOCK(state); change_irq = new_serial.irq != port->irq; change_port = new_port != port->iobase || (unsigned long)new_serial.iomem_base != port->mapbase || new_serial.hub6 != port->hub6 || new_serial.io_type != port->iotype || new_serial.iomem_reg_shift != port->regshift || new_serial.type != port->type; old_flags = port->flags; new_flags = new_serial.flags; old_custom_divisor = port->custom_divisor; if (!capable(CAP_SYS_ADMIN)) { retval = -EPERM; if (change_irq || change_port || (new_serial.baud_base != port->uartclk / 16) || (new_serial.close_delay != state->close_delay) || (closing_wait != state->closing_wait) || (new_serial.xmit_fifo_size != port->fifosize) || (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0)) goto exit; port->flags = ((port->flags & ~UPF_USR_MASK) | (new_flags & UPF_USR_MASK)); port->custom_divisor = new_serial.custom_divisor; goto check_and_exit; } if (port->ops->verify_port) retval = port->ops->verify_port(port, &new_serial); if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || (new_serial.baud_base < 9600)) retval = -EINVAL; if (retval) goto exit; if (change_port || change_irq) { retval = -EBUSY; if (uart_users(state) > 1) goto exit; mp_shutdown(state); } if (change_port) { unsigned long old_iobase, old_mapbase; unsigned int old_type, old_iotype, old_hub6, old_shift; old_iobase = port->iobase; old_mapbase = port->mapbase; old_type = port->type; old_hub6 = port->hub6; old_iotype = port->iotype; old_shift = port->regshift; if (old_type != PORT_UNKNOWN) port->ops->release_port(port); port->iobase = new_port; port->type = new_serial.type; port->hub6 = new_serial.hub6; port->iotype = new_serial.io_type; port->regshift = new_serial.iomem_reg_shift; port->mapbase = (unsigned long)new_serial.iomem_base; if (port->type != PORT_UNKNOWN) { retval = port->ops->request_port(port); } else { retval = 0; } if (retval && old_type != PORT_UNKNOWN) { port->iobase = old_iobase; port->type = old_type; port->hub6 = old_hub6; port->iotype = old_iotype; port->regshift = old_shift; port->mapbase = old_mapbase; retval = port->ops->request_port(port); if (retval) port->type = PORT_UNKNOWN; retval = -EBUSY; } } port->irq = new_serial.irq; port->uartclk = new_serial.baud_base * 16; port->flags = (port->flags & ~UPF_CHANGE_MASK) | (new_flags & UPF_CHANGE_MASK); port->custom_divisor = new_serial.custom_divisor; state->close_delay = new_serial.close_delay; state->closing_wait = closing_wait; port->fifosize = new_serial.xmit_fifo_size; if (state->info->tty) state->info->tty->low_latency = (port->flags & UPF_LOW_LATENCY) ? 1 : 0; check_and_exit: retval = 0; if (port->type == PORT_UNKNOWN) goto exit; if (state->info->flags & UIF_INITIALIZED) { if (((old_flags ^ port->flags) & UPF_SPD_MASK) || old_custom_divisor != port->custom_divisor) { if (port->flags & UPF_SPD_MASK) { printk(KERN_NOTICE "%s sets custom speed on ttyMP%d. This " "is deprecated.\n", current->comm, port->line); } mp_change_speed(state, NULL); } } else retval = mp_startup(state, 1); exit: MP_STATE_UNLOCK(state); return retval; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,532
static void mp_set_termios(struct tty_struct *tty, struct MP_TERMIOS *old_termios) { struct sb_uart_state *state = tty->driver_data; unsigned long flags; unsigned int cflag = tty->termios.c_cflag; #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) if ((cflag ^ old_termios->c_cflag) == 0 && RELEVANT_IFLAG(tty->termios.c_iflag ^ old_termios->c_iflag) == 0) return; mp_change_speed(state, old_termios); if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR); if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { unsigned int mask = TIOCM_DTR; if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) mask |= TIOCM_RTS; uart_set_mctrl(state->port, mask); } if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) { spin_lock_irqsave(&state->port->lock, flags); tty->hw_stopped = 0; __mp_start(tty); spin_unlock_irqrestore(&state->port->lock, flags); } if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { spin_lock_irqsave(&state->port->lock, flags); if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { tty->hw_stopped = 1; state->port->ops->stop_tx(state->port); } spin_unlock_irqrestore(&state->port->lock, flags); } }
+Info
0
static void mp_set_termios(struct tty_struct *tty, struct MP_TERMIOS *old_termios) { struct sb_uart_state *state = tty->driver_data; unsigned long flags; unsigned int cflag = tty->termios.c_cflag; #define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) if ((cflag ^ old_termios->c_cflag) == 0 && RELEVANT_IFLAG(tty->termios.c_iflag ^ old_termios->c_iflag) == 0) return; mp_change_speed(state, old_termios); if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR); if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { unsigned int mask = TIOCM_DTR; if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) mask |= TIOCM_RTS; uart_set_mctrl(state->port, mask); } if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) { spin_lock_irqsave(&state->port->lock, flags); tty->hw_stopped = 0; __mp_start(tty); spin_unlock_irqrestore(&state->port->lock, flags); } if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { spin_lock_irqsave(&state->port->lock, flags); if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { tty->hw_stopped = 1; state->port->ops->stop_tx(state->port); } spin_unlock_irqrestore(&state->port->lock, flags); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,533
static void mp_shutdown(struct sb_uart_state *state) { struct sb_uart_info *info = state->info; struct sb_uart_port *port = state->port; if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); if (info->flags & UIF_INITIALIZED) { info->flags &= ~UIF_INITIALIZED; if (!info->tty || (info->tty->termios.c_cflag & HUPCL)) uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); wake_up_interruptible(&info->delta_msr_wait); port->ops->shutdown(port); synchronize_irq(port->irq); } tasklet_kill(&info->tlet); if (info->xmit.buf) { free_page((unsigned long)info->xmit.buf); info->xmit.buf = NULL; } }
+Info
0
static void mp_shutdown(struct sb_uart_state *state) { struct sb_uart_info *info = state->info; struct sb_uart_port *port = state->port; if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); if (info->flags & UIF_INITIALIZED) { info->flags &= ~UIF_INITIALIZED; if (!info->tty || (info->tty->termios.c_cflag & HUPCL)) uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); wake_up_interruptible(&info->delta_msr_wait); port->ops->shutdown(port); synchronize_irq(port->irq); } tasklet_kill(&info->tlet); if (info->xmit.buf) { free_page((unsigned long)info->xmit.buf); info->xmit.buf = NULL; } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,534
static void mp_start(struct tty_struct *tty) { __mp_start(tty); }
+Info
0
static void mp_start(struct tty_struct *tty) { __mp_start(tty); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,535
static void mp_stop(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->ops->stop_tx(port); spin_unlock_irqrestore(&port->lock, flags); }
+Info
0
static void mp_stop(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->ops->stop_tx(port); spin_unlock_irqrestore(&port->lock, flags); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,536
static void mp_tasklet_action(unsigned long data) { struct sb_uart_state *state = (struct sb_uart_state *)data; struct tty_struct *tty; printk("tasklet is called!\n"); tty = state->info->tty; tty_wakeup(tty); }
+Info
0
static void mp_tasklet_action(unsigned long data) { struct sb_uart_state *state = (struct sb_uart_state *)data; struct tty_struct *tty; printk("tasklet is called!\n"); tty = state->info->tty; tty_wakeup(tty); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,537
static int mp_tiocmget(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; int result = -EIO; MP_STATE_LOCK(state); if (!(tty->flags & (1 << TTY_IO_ERROR))) { result = port->mctrl; spin_lock_irq(&port->lock); result |= port->ops->get_mctrl(port); spin_unlock_irq(&port->lock); } MP_STATE_UNLOCK(state); return result; }
+Info
0
static int mp_tiocmget(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; int result = -EIO; MP_STATE_LOCK(state); if (!(tty->flags & (1 << TTY_IO_ERROR))) { result = port->mctrl; spin_lock_irq(&port->lock); result |= port->ops->get_mctrl(port); spin_unlock_irq(&port->lock); } MP_STATE_UNLOCK(state); return result; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,538
static int mp_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; int ret = -EIO; MP_STATE_LOCK(state); if (!(tty->flags & (1 << TTY_IO_ERROR))) { mp_update_mctrl(port, set, clear); ret = 0; } MP_STATE_UNLOCK(state); return ret; }
+Info
0
static int mp_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; int ret = -EIO; MP_STATE_LOCK(state); if (!(tty->flags & (1 << TTY_IO_ERROR))) { mp_update_mctrl(port, set, clear); ret = 0; } MP_STATE_UNLOCK(state); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,539
static const char *mp_type(struct sb_uart_port *port) { const char *str = NULL; if (port->ops->type) str = port->ops->type(port); if (!str) str = "unknown"; return str; }
+Info
0
static const char *mp_type(struct sb_uart_port *port) { const char *str = NULL; if (port->ops->type) str = port->ops->type(port); if (!str) str = "unknown"; return str; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,540
static void mp_unconfigure_port(struct uart_driver *drv, struct sb_uart_state *state) { struct sb_uart_port *port = state->port; struct sb_uart_info *info = state->info; if (info && info->tty) tty_hangup(info->tty); MP_STATE_LOCK(state); state->info = NULL; if (port->type != PORT_UNKNOWN) port->ops->release_port(port); port->type = PORT_UNKNOWN; if (info) { tasklet_kill(&info->tlet); kfree(info); } MP_STATE_UNLOCK(state); }
+Info
0
static void mp_unconfigure_port(struct uart_driver *drv, struct sb_uart_state *state) { struct sb_uart_port *port = state->port; struct sb_uart_info *info = state->info; if (info && info->tty) tty_hangup(info->tty); MP_STATE_LOCK(state); state->info = NULL; if (port->type != PORT_UNKNOWN) port->ops->release_port(port); port->type = PORT_UNKNOWN; if (info) { tasklet_kill(&info->tlet); kfree(info); } MP_STATE_UNLOCK(state); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,541
void mp_unregister_driver(struct uart_driver *drv) { struct tty_driver *normal = NULL; normal = drv->tty_driver; if (!normal) { return; } tty_unregister_driver(normal); put_tty_driver(normal); drv->tty_driver = NULL; if (drv->state) { kfree(drv->state); } }
+Info
0
void mp_unregister_driver(struct uart_driver *drv) { struct tty_driver *normal = NULL; normal = drv->tty_driver; if (!normal) { return; } tty_unregister_driver(normal); put_tty_driver(normal); drv->tty_driver = NULL; if (drv->state) { kfree(drv->state); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,542
static void mp_unthrottle(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; if (I_IXOFF(tty)) { if (port->x_char) port->x_char = 0; else mp_send_xchar(tty, START_CHAR(tty)); } if (tty->termios.c_cflag & CRTSCTS) uart_set_mctrl(port, TIOCM_RTS); }
+Info
0
static void mp_unthrottle(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; if (I_IXOFF(tty)) { if (port->x_char) port->x_char = 0; else mp_send_xchar(tty, START_CHAR(tty)); } if (tty->termios.c_cflag & CRTSCTS) uart_set_mctrl(port, TIOCM_RTS); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,543
static inline void mp_update_mctrl(struct sb_uart_port *port, unsigned int set, unsigned int clear) { unsigned int old; old = port->mctrl; port->mctrl = (old & ~clear) | set; if (old != port->mctrl) port->ops->set_mctrl(port, port->mctrl); }
+Info
0
static inline void mp_update_mctrl(struct sb_uart_port *port, unsigned int set, unsigned int clear) { unsigned int old; old = port->mctrl; port->mctrl = (old & ~clear) | set; if (old != port->mctrl) port->ops->set_mctrl(port, port->mctrl); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,544
static void mp_update_termios(struct sb_uart_state *state) { struct tty_struct *tty = state->info->tty; struct sb_uart_port *port = state->port; if (!(tty->flags & (1 << TTY_IO_ERROR))) { mp_change_speed(state, NULL); if (tty->termios.c_cflag & CBAUD) uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS); } }
+Info
0
static void mp_update_termios(struct sb_uart_state *state) { struct tty_struct *tty = state->info->tty; struct sb_uart_port *port = state->port; if (!(tty->flags & (1 << TTY_IO_ERROR))) { mp_change_speed(state, NULL); if (tty->termios.c_cflag & CBAUD) uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,545
static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) { struct sb_uart_port *port = state->port; DECLARE_WAITQUEUE(wait, current); struct sb_uart_icount cprev, cnow; int ret; spin_lock_irq(&port->lock); memcpy(&cprev, &port->icount, sizeof(struct sb_uart_icount)); port->ops->enable_ms(port); spin_unlock_irq(&port->lock); add_wait_queue(&state->info->delta_msr_wait, &wait); for (;;) { spin_lock_irq(&port->lock); memcpy(&cnow, &port->icount, sizeof(struct sb_uart_icount)); spin_unlock_irq(&port->lock); set_current_state(TASK_INTERRUPTIBLE); if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { ret = 0; break; } schedule(); if (signal_pending(current)) { ret = -ERESTARTSYS; break; } cprev = cnow; } current->state = TASK_RUNNING; remove_wait_queue(&state->info->delta_msr_wait, &wait); return ret; }
+Info
0
static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) { struct sb_uart_port *port = state->port; DECLARE_WAITQUEUE(wait, current); struct sb_uart_icount cprev, cnow; int ret; spin_lock_irq(&port->lock); memcpy(&cprev, &port->icount, sizeof(struct sb_uart_icount)); port->ops->enable_ms(port); spin_unlock_irq(&port->lock); add_wait_queue(&state->info->delta_msr_wait, &wait); for (;;) { spin_lock_irq(&port->lock); memcpy(&cnow, &port->icount, sizeof(struct sb_uart_icount)); spin_unlock_irq(&port->lock); set_current_state(TASK_INTERRUPTIBLE); if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { ret = 0; break; } schedule(); if (signal_pending(current)) { ret = -ERESTARTSYS; break; } cprev = cnow; } current->state = TASK_RUNNING; remove_wait_queue(&state->info->delta_msr_wait, &wait); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,546
static void mp_wait_until_sent(struct tty_struct *tty, int timeout) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; unsigned long char_time, expire; if (port->type == PORT_UNKNOWN || port->fifosize == 0) return; char_time = (port->timeout - HZ/50) / port->fifosize; char_time = char_time / 5; if (char_time == 0) char_time = 1; if (timeout && timeout < char_time) char_time = timeout; if (timeout == 0 || timeout > 2 * port->timeout) timeout = 2 * port->timeout; expire = jiffies + timeout; while (!port->ops->tx_empty(port)) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(char_time); if (signal_pending(current)) break; if (time_after(jiffies, expire)) break; } set_current_state(TASK_RUNNING); /* might not be needed */ }
+Info
0
static void mp_wait_until_sent(struct tty_struct *tty, int timeout) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port = state->port; unsigned long char_time, expire; if (port->type == PORT_UNKNOWN || port->fifosize == 0) return; char_time = (port->timeout - HZ/50) / port->fifosize; char_time = char_time / 5; if (char_time == 0) char_time = 1; if (timeout && timeout < char_time) char_time = timeout; if (timeout == 0 || timeout > 2 * port->timeout) timeout = 2 * port->timeout; expire = jiffies + timeout; while (!port->ops->tx_empty(port)) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(char_time); if (signal_pending(current)) break; if (time_after(jiffies, expire)) break; } set_current_state(TASK_RUNNING); /* might not be needed */ }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,547
static int mp_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; struct circ_buf *circ; int c, ret = 0; if (!state || !state->info) { return -EL3HLT; } port = state->port; circ = &state->info->xmit; if (!circ->buf) return 0; while (1) { c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); if (count < c) c = count; if (c <= 0) break; memcpy(circ->buf + circ->head, buf, c); circ->head = (circ->head + c) & (UART_XMIT_SIZE - 1); buf += c; count -= c; ret += c; } mp_start(tty); return ret; }
+Info
0
static int mp_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct sb_uart_state *state = tty->driver_data; struct sb_uart_port *port; struct circ_buf *circ; int c, ret = 0; if (!state || !state->info) { return -EL3HLT; } port = state->port; circ = &state->info->xmit; if (!circ->buf) return 0; while (1) { c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); if (count < c) c = count; if (c <= 0) break; memcpy(circ->buf + circ->head, buf, c); circ->head = (circ->head + c) & (UART_XMIT_SIZE - 1); buf += c; count -= c; ret += c; } mp_start(tty); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,548
static int mp_write_room(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; return uart_circ_chars_free(&state->info->xmit); }
+Info
0
static int mp_write_room(struct tty_struct *tty) { struct sb_uart_state *state = tty->driver_data; return uart_circ_chars_free(&state->info->xmit); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,549
static void multi_break_ctl(struct sb_uart_port *port, int break_state) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; spin_lock_irqsave(&mtpt->port.lock, flags); if (break_state == -1) mtpt->lcr |= UART_LCR_SBC; else mtpt->lcr &= ~UART_LCR_SBC; serial_out(mtpt, UART_LCR, mtpt->lcr); spin_unlock_irqrestore(&mtpt->port.lock, flags); }
+Info
0
static void multi_break_ctl(struct sb_uart_port *port, int break_state) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; spin_lock_irqsave(&mtpt->port.lock, flags); if (break_state == -1) mtpt->lcr |= UART_LCR_SBC; else mtpt->lcr &= ~UART_LCR_SBC; serial_out(mtpt, UART_LCR, mtpt->lcr); spin_unlock_irqrestore(&mtpt->port.lock, flags); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,550
static void multi_enable_ms(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; mtpt->ier |= UART_IER_MSI; serial_out(mtpt, UART_IER, mtpt->ier); }
+Info
0
static void multi_enable_ms(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; mtpt->ier |= UART_IER_MSI; serial_out(mtpt, UART_IER, mtpt->ier); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,551
static void __exit multi_exit(void) { int i; for (i = 0; i < NR_PORTS; i++) mp_remove_one_port(&multi_reg, &multi_ports[i].port); mp_unregister_driver(&multi_reg); }
+Info
0
static void __exit multi_exit(void) { int i; for (i = 0; i < NR_PORTS; i++) mp_remove_one_port(&multi_reg, &multi_ports[i].port); mp_unregister_driver(&multi_reg); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,552
static unsigned int multi_get_divisor(struct sb_uart_port *port, unsigned int baud) { unsigned int quot; if ((port->flags & UPF_MAGIC_MULTIPLIER) && baud == (port->uartclk/4)) quot = 0x8001; else if ((port->flags & UPF_MAGIC_MULTIPLIER) && baud == (port->uartclk/8)) quot = 0x8002; else quot = sb_uart_get_divisor(port, baud); return quot; }
+Info
0
static unsigned int multi_get_divisor(struct sb_uart_port *port, unsigned int baud) { unsigned int quot; if ((port->flags & UPF_MAGIC_MULTIPLIER) && baud == (port->uartclk/4)) quot = 0x8001; else if ((port->flags & UPF_MAGIC_MULTIPLIER) && baud == (port->uartclk/8)) quot = 0x8002; else quot = sb_uart_get_divisor(port, baud); return quot; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,553
static unsigned int multi_get_mctrl(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char status; unsigned int ret; status = serial_in(mtpt, UART_MSR); ret = 0; if (status & UART_MSR_DCD) ret |= TIOCM_CAR; if (status & UART_MSR_RI) ret |= TIOCM_RNG; if (status & UART_MSR_DSR) ret |= TIOCM_DSR; if (status & UART_MSR_CTS) ret |= TIOCM_CTS; return ret; }
+Info
0
static unsigned int multi_get_mctrl(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char status; unsigned int ret; status = serial_in(mtpt, UART_MSR); ret = 0; if (status & UART_MSR_DCD) ret |= TIOCM_CAR; if (status & UART_MSR_RI) ret |= TIOCM_RNG; if (status & UART_MSR_DSR) ret |= TIOCM_DSR; if (status & UART_MSR_CTS) ret |= TIOCM_CTS; return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,554
static int __init multi_init(void) { int ret, i; struct pci_dev *dev = NULL; if(fcr_count==0) { for(i=0;i<256;i++) { fcr_arr[i] = 0x01; } } if(deep_count==0) { for(i=0;i<256;i++) { deep[i] = 1; } } if(rtr_count==0) { for(i=0;i<256;i++) { rtr[i] = 0x10; } } if(ttr_count==0) { for(i=0;i<256;i++) { ttr[i] = 0x38; } } printk("MULTI INIT\n"); for( i=0; i< mp_nrpcibrds; i++) { while( (dev = pci_get_device(mp_pciboards[i].vendor_id, mp_pciboards[i].device_id, dev) ) ) { printk("FOUND~~~\n"); { int status; pci_disable_device(dev); status = pci_enable_device(dev); if (status != 0) { printk("Multiport Board Enable Fail !\n\n"); status = -ENXIO; return status; } } init_mp_dev(dev, mp_pciboards[i]); } } for (i = 0; i < NR_IRQS; i++) spin_lock_init(&irq_lists[i].lock); ret = mp_register_driver(&multi_reg); if (ret >= 0) multi_register_ports(&multi_reg); return ret; }
+Info
0
static int __init multi_init(void) { int ret, i; struct pci_dev *dev = NULL; if(fcr_count==0) { for(i=0;i<256;i++) { fcr_arr[i] = 0x01; } } if(deep_count==0) { for(i=0;i<256;i++) { deep[i] = 1; } } if(rtr_count==0) { for(i=0;i<256;i++) { rtr[i] = 0x10; } } if(ttr_count==0) { for(i=0;i<256;i++) { ttr[i] = 0x38; } } printk("MULTI INIT\n"); for( i=0; i< mp_nrpcibrds; i++) { while( (dev = pci_get_device(mp_pciboards[i].vendor_id, mp_pciboards[i].device_id, dev) ) ) { printk("FOUND~~~\n"); { int status; pci_disable_device(dev); status = pci_enable_device(dev); if (status != 0) { printk("Multiport Board Enable Fail !\n\n"); status = -ENXIO; return status; } } init_mp_dev(dev, mp_pciboards[i]); } } for (i = 0; i < NR_IRQS; i++) spin_lock_init(&irq_lists[i].lock); ret = mp_register_driver(&multi_reg); if (ret >= 0) multi_register_ports(&multi_reg); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,555
static irqreturn_t multi_interrupt(int irq, void *dev_id) { struct irq_info *iinfo = dev_id; struct list_head *lhead, *end = NULL; int pass_counter = 0; spin_lock(&iinfo->lock); lhead = iinfo->head; do { struct mp_port *mtpt; unsigned int iir; mtpt = list_entry(lhead, struct mp_port, list); iir = serial_in(mtpt, UART_IIR); printk("interrupt! port %d, iir 0x%x\n", mtpt->port.line, iir); //wlee if (!(iir & UART_IIR_NO_INT)) { printk("interrupt handle\n"); spin_lock(&mtpt->port.lock); multi_handle_port(mtpt); spin_unlock(&mtpt->port.lock); end = NULL; } else if (end == NULL) end = lhead; lhead = lhead->next; if (lhead == iinfo->head && pass_counter++ > PASS_LIMIT) { printk(KERN_ERR "multi: too much work for " "irq%d\n", irq); printk( "multi: too much work for " "irq%d\n", irq); break; } } while (lhead != end); spin_unlock(&iinfo->lock); return IRQ_HANDLED; }
+Info
0
static irqreturn_t multi_interrupt(int irq, void *dev_id) { struct irq_info *iinfo = dev_id; struct list_head *lhead, *end = NULL; int pass_counter = 0; spin_lock(&iinfo->lock); lhead = iinfo->head; do { struct mp_port *mtpt; unsigned int iir; mtpt = list_entry(lhead, struct mp_port, list); iir = serial_in(mtpt, UART_IIR); printk("interrupt! port %d, iir 0x%x\n", mtpt->port.line, iir); //wlee if (!(iir & UART_IIR_NO_INT)) { printk("interrupt handle\n"); spin_lock(&mtpt->port.lock); multi_handle_port(mtpt); spin_unlock(&mtpt->port.lock); end = NULL; } else if (end == NULL) end = lhead; lhead = lhead->next; if (lhead == iinfo->head && pass_counter++ > PASS_LIMIT) { printk(KERN_ERR "multi: too much work for " "irq%d\n", irq); printk( "multi: too much work for " "irq%d\n", irq); break; } } while (lhead != end); spin_unlock(&iinfo->lock); return IRQ_HANDLED; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,556
static void multi_pm(struct sb_uart_port *port, unsigned int state, unsigned int oldstate) { struct mp_port *mtpt = (struct mp_port *)port; if (state) { if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, UART_EFR_ECB); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_IER, UART_IERX_SLEEP); serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); } if (mtpt->pm) mtpt->pm(port, state, oldstate); } else { if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, UART_EFR_ECB); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_IER, 0); serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); } if (mtpt->pm) mtpt->pm(port, state, oldstate); } }
+Info
0
static void multi_pm(struct sb_uart_port *port, unsigned int state, unsigned int oldstate) { struct mp_port *mtpt = (struct mp_port *)port; if (state) { if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, UART_EFR_ECB); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_IER, UART_IERX_SLEEP); serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); } if (mtpt->pm) mtpt->pm(port, state, oldstate); } else { if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, UART_EFR_ECB); serial_outp(mtpt, UART_LCR, 0); serial_outp(mtpt, UART_IER, 0); serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, 0); serial_outp(mtpt, UART_LCR, 0); } if (mtpt->pm) mtpt->pm(port, state, oldstate); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,557
static void __init multi_register_ports(struct uart_driver *drv) { int i; multi_init_ports(); for (i = 0; i < NR_PORTS; i++) { struct mp_port *mtpt = &multi_ports[i]; mtpt->port.line = i; mtpt->port.ops = &multi_pops; init_timer(&mtpt->timer); mtpt->timer.function = multi_timeout; mp_add_one_port(drv, &mtpt->port); } }
+Info
0
static void __init multi_register_ports(struct uart_driver *drv) { int i; multi_init_ports(); for (i = 0; i < NR_PORTS; i++) { struct mp_port *mtpt = &multi_ports[i]; mtpt->port.line = i; mtpt->port.ops = &multi_pops; init_timer(&mtpt->timer); mtpt->timer.function = multi_timeout; mp_add_one_port(drv, &mtpt->port); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,558
static void multi_release_std_resource(struct mp_port *mtpt) { unsigned int size = 8 << mtpt->port.regshift; switch (mtpt->port.iotype) { case UPIO_MEM: if (!mtpt->port.mapbase) break; if (mtpt->port.flags & UPF_IOREMAP) { iounmap(mtpt->port.membase); mtpt->port.membase = NULL; } release_mem_region(mtpt->port.mapbase, size); break; case UPIO_HUB6: case UPIO_PORT: release_region(mtpt->port.iobase,size); break; } }
+Info
0
static void multi_release_std_resource(struct mp_port *mtpt) { unsigned int size = 8 << mtpt->port.regshift; switch (mtpt->port.iotype) { case UPIO_MEM: if (!mtpt->port.mapbase) break; if (mtpt->port.flags & UPF_IOREMAP) { iounmap(mtpt->port.membase); mtpt->port.membase = NULL; } release_mem_region(mtpt->port.mapbase, size); break; case UPIO_HUB6: case UPIO_PORT: release_region(mtpt->port.iobase,size); break; } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,559
static void multi_set_mctrl(struct sb_uart_port *port, unsigned int mctrl) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char mcr = 0; mctrl &= 0xff; if (mctrl & TIOCM_RTS) mcr |= UART_MCR_RTS; if (mctrl & TIOCM_DTR) mcr |= UART_MCR_DTR; if (mctrl & TIOCM_OUT1) mcr |= UART_MCR_OUT1; if (mctrl & TIOCM_OUT2) mcr |= UART_MCR_OUT2; if (mctrl & TIOCM_LOOP) mcr |= UART_MCR_LOOP; serial_out(mtpt, UART_MCR, mcr); }
+Info
0
static void multi_set_mctrl(struct sb_uart_port *port, unsigned int mctrl) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char mcr = 0; mctrl &= 0xff; if (mctrl & TIOCM_RTS) mcr |= UART_MCR_RTS; if (mctrl & TIOCM_DTR) mcr |= UART_MCR_DTR; if (mctrl & TIOCM_OUT1) mcr |= UART_MCR_OUT1; if (mctrl & TIOCM_OUT2) mcr |= UART_MCR_OUT2; if (mctrl & TIOCM_LOOP) mcr |= UART_MCR_LOOP; serial_out(mtpt, UART_MCR, mcr); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,560
static void multi_set_termios(struct sb_uart_port *port, struct MP_TERMIOS *termios, struct MP_TERMIOS *old) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char cval, fcr = 0; unsigned long flags; unsigned int baud, quot; switch (termios->c_cflag & CSIZE) { case CS5: cval = 0x00; break; case CS6: cval = 0x01; break; case CS7: cval = 0x02; break; default: case CS8: cval = 0x03; break; } if (termios->c_cflag & CSTOPB) cval |= 0x04; if (termios->c_cflag & PARENB) cval |= UART_LCR_PARITY; if (!(termios->c_cflag & PARODD)) cval |= UART_LCR_EPAR; #ifdef CMSPAR if (termios->c_cflag & CMSPAR) cval |= UART_LCR_SPAR; #endif baud = sb_uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); quot = multi_get_divisor(port, baud); if (mtpt->capabilities & UART_USE_FIFO) { fcr = fcr_arr[mtpt->port.line]; } spin_lock_irqsave(&mtpt->port.lock, flags); sb_uart_update_timeout(port, termios->c_cflag, baud); mtpt->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; if (termios->c_iflag & INPCK) mtpt->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; if (termios->c_iflag & (BRKINT | PARMRK)) mtpt->port.read_status_mask |= UART_LSR_BI; mtpt->port.ignore_status_mask = 0; if (termios->c_iflag & IGNPAR) mtpt->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; if (termios->c_iflag & IGNBRK) { mtpt->port.ignore_status_mask |= UART_LSR_BI; if (termios->c_iflag & IGNPAR) mtpt->port.ignore_status_mask |= UART_LSR_OE; } if ((termios->c_cflag & CREAD) == 0) mtpt->port.ignore_status_mask |= UART_LSR_DR; mtpt->ier &= ~UART_IER_MSI; if (UART_ENABLE_MS(&mtpt->port, termios->c_cflag)) mtpt->ier |= UART_IER_MSI; serial_out(mtpt, UART_IER, mtpt->ier); if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, termios->c_cflag & CRTSCTS ? UART_EFR_CTS :0); } serial_outp(mtpt, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ serial_outp(mtpt, UART_DLL, quot & 0xff); /* LS of divisor */ serial_outp(mtpt, UART_DLM, quot >> 8); /* MS of divisor */ serial_outp(mtpt, UART_LCR, cval); /* reset DLAB */ mtpt->lcr = cval; /* Save LCR */ if (fcr & UART_FCR_ENABLE_FIFO) { /* emulated UARTs (Lucent Venus 167x) need two steps */ serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO); } serial_outp(mtpt, UART_FCR, fcr); /* set fcr */ if ((mtpt->port.type == PORT_16C105X) || (mtpt->port.type == PORT_16C105XA)) { if(deep[mtpt->port.line]!=0) set_deep_fifo(port, ENABLE); if (mtpt->interface != RS232) set_auto_rts(port,mtpt->interface); } else { if (mtpt->interface >= RS485NE) { uart_clear_mctrl(&mtpt->port, TIOCM_RTS); } } if(mtpt->device->device_id == PCI_DEVICE_ID_MP4M) { SendATCommand(mtpt); printk("SendATCommand\n"); } multi_set_mctrl(&mtpt->port, mtpt->port.mctrl); spin_unlock_irqrestore(&mtpt->port.lock, flags); }
+Info
0
static void multi_set_termios(struct sb_uart_port *port, struct MP_TERMIOS *termios, struct MP_TERMIOS *old) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char cval, fcr = 0; unsigned long flags; unsigned int baud, quot; switch (termios->c_cflag & CSIZE) { case CS5: cval = 0x00; break; case CS6: cval = 0x01; break; case CS7: cval = 0x02; break; default: case CS8: cval = 0x03; break; } if (termios->c_cflag & CSTOPB) cval |= 0x04; if (termios->c_cflag & PARENB) cval |= UART_LCR_PARITY; if (!(termios->c_cflag & PARODD)) cval |= UART_LCR_EPAR; #ifdef CMSPAR if (termios->c_cflag & CMSPAR) cval |= UART_LCR_SPAR; #endif baud = sb_uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); quot = multi_get_divisor(port, baud); if (mtpt->capabilities & UART_USE_FIFO) { fcr = fcr_arr[mtpt->port.line]; } spin_lock_irqsave(&mtpt->port.lock, flags); sb_uart_update_timeout(port, termios->c_cflag, baud); mtpt->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; if (termios->c_iflag & INPCK) mtpt->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; if (termios->c_iflag & (BRKINT | PARMRK)) mtpt->port.read_status_mask |= UART_LSR_BI; mtpt->port.ignore_status_mask = 0; if (termios->c_iflag & IGNPAR) mtpt->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; if (termios->c_iflag & IGNBRK) { mtpt->port.ignore_status_mask |= UART_LSR_BI; if (termios->c_iflag & IGNPAR) mtpt->port.ignore_status_mask |= UART_LSR_OE; } if ((termios->c_cflag & CREAD) == 0) mtpt->port.ignore_status_mask |= UART_LSR_DR; mtpt->ier &= ~UART_IER_MSI; if (UART_ENABLE_MS(&mtpt->port, termios->c_cflag)) mtpt->ier |= UART_IER_MSI; serial_out(mtpt, UART_IER, mtpt->ier); if (mtpt->capabilities & UART_STARTECH) { serial_outp(mtpt, UART_LCR, 0xBF); serial_outp(mtpt, UART_EFR, termios->c_cflag & CRTSCTS ? UART_EFR_CTS :0); } serial_outp(mtpt, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ serial_outp(mtpt, UART_DLL, quot & 0xff); /* LS of divisor */ serial_outp(mtpt, UART_DLM, quot >> 8); /* MS of divisor */ serial_outp(mtpt, UART_LCR, cval); /* reset DLAB */ mtpt->lcr = cval; /* Save LCR */ if (fcr & UART_FCR_ENABLE_FIFO) { /* emulated UARTs (Lucent Venus 167x) need two steps */ serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO); } serial_outp(mtpt, UART_FCR, fcr); /* set fcr */ if ((mtpt->port.type == PORT_16C105X) || (mtpt->port.type == PORT_16C105XA)) { if(deep[mtpt->port.line]!=0) set_deep_fifo(port, ENABLE); if (mtpt->interface != RS232) set_auto_rts(port,mtpt->interface); } else { if (mtpt->interface >= RS485NE) { uart_clear_mctrl(&mtpt->port, TIOCM_RTS); } } if(mtpt->device->device_id == PCI_DEVICE_ID_MP4M) { SendATCommand(mtpt); printk("SendATCommand\n"); } multi_set_mctrl(&mtpt->port, mtpt->port.mctrl); spin_unlock_irqrestore(&mtpt->port.lock, flags); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,561
static void multi_shutdown(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; mtpt->ier = 0; serial_outp(mtpt, UART_IER, 0); spin_lock_irqsave(&mtpt->port.lock, flags); mtpt->port.mctrl &= ~TIOCM_OUT2; multi_set_mctrl(&mtpt->port, mtpt->port.mctrl); spin_unlock_irqrestore(&mtpt->port.lock, flags); serial_out(mtpt, UART_LCR, serial_inp(mtpt, UART_LCR) & ~UART_LCR_SBC); serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); serial_outp(mtpt, UART_FCR, 0); (void) serial_in(mtpt, UART_RX); if ((!is_real_interrupt(mtpt->port.irq))||(mtpt->poll_type==TYPE_POLL)) { del_timer_sync(&mtpt->timer); } else { serial_unlink_irq_chain(mtpt); } }
+Info
0
static void multi_shutdown(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; mtpt->ier = 0; serial_outp(mtpt, UART_IER, 0); spin_lock_irqsave(&mtpt->port.lock, flags); mtpt->port.mctrl &= ~TIOCM_OUT2; multi_set_mctrl(&mtpt->port, mtpt->port.mctrl); spin_unlock_irqrestore(&mtpt->port.lock, flags); serial_out(mtpt, UART_LCR, serial_inp(mtpt, UART_LCR) & ~UART_LCR_SBC); serial_outp(mtpt, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); serial_outp(mtpt, UART_FCR, 0); (void) serial_in(mtpt, UART_RX); if ((!is_real_interrupt(mtpt->port.irq))||(mtpt->poll_type==TYPE_POLL)) { del_timer_sync(&mtpt->timer); } else { serial_unlink_irq_chain(mtpt); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,562
static void multi_start_tx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; if (!(mtpt->ier & UART_IER_THRI)) { mtpt->ier |= UART_IER_THRI; serial_out(mtpt, UART_IER, mtpt->ier); } }
+Info
0
static void multi_start_tx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; if (!(mtpt->ier & UART_IER_THRI)) { mtpt->ier |= UART_IER_THRI; serial_out(mtpt, UART_IER, mtpt->ier); } }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,563
static void multi_stop_rx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; mtpt->ier &= ~UART_IER_RLSI; mtpt->port.read_status_mask &= ~UART_LSR_DR; serial_out(mtpt, UART_IER, mtpt->ier); }
+Info
0
static void multi_stop_rx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; mtpt->ier &= ~UART_IER_RLSI; mtpt->port.read_status_mask &= ~UART_LSR_DR; serial_out(mtpt, UART_IER, mtpt->ier); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,564
static void multi_stop_tx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; if (mtpt->ier & UART_IER_THRI) { mtpt->ier &= ~UART_IER_THRI; serial_out(mtpt, UART_IER, mtpt->ier); } tasklet_schedule(&port->info->tlet); }
+Info
0
static void multi_stop_tx(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; if (mtpt->ier & UART_IER_THRI) { mtpt->ier &= ~UART_IER_THRI; serial_out(mtpt, UART_IER, mtpt->ier); } tasklet_schedule(&port->info->tlet); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,565
static void multi_timeout(unsigned long data) { struct mp_port *mtpt = (struct mp_port *)data; spin_lock(&mtpt->port.lock); multi_handle_port(mtpt); spin_unlock(&mtpt->port.lock); mod_timer(&mtpt->timer, jiffies+1 ); }
+Info
0
static void multi_timeout(unsigned long data) { struct mp_port *mtpt = (struct mp_port *)data; spin_lock(&mtpt->port.lock); multi_handle_port(mtpt); spin_unlock(&mtpt->port.lock); mod_timer(&mtpt->timer, jiffies+1 ); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,566
static unsigned int multi_tx_empty(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; unsigned int ret; spin_lock_irqsave(&mtpt->port.lock, flags); ret = serial_in(mtpt, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; spin_unlock_irqrestore(&mtpt->port.lock, flags); return ret; }
+Info
0
static unsigned int multi_tx_empty(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned long flags; unsigned int ret; spin_lock_irqsave(&mtpt->port.lock, flags); ret = serial_in(mtpt, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; spin_unlock_irqrestore(&mtpt->port.lock, flags); return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,567
static const char *multi_type(struct sb_uart_port *port) { int type = port->type; if (type >= ARRAY_SIZE(uart_config)) type = 0; return uart_config[type].name; }
+Info
0
static const char *multi_type(struct sb_uart_port *port) { int type = port->type; if (type >= ARRAY_SIZE(uart_config)) type = 0; return uart_config[type].name; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,568
static int multi_verify_port(struct sb_uart_port *port, struct serial_struct *ser) { if (ser->irq >= NR_IRQS || ser->irq < 0 || ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || ser->type == PORT_STARTECH) return -EINVAL; return 0; }
+Info
0
static int multi_verify_port(struct sb_uart_port *port, struct serial_struct *ser) { if (ser->irq >= NR_IRQS || ser->irq < 0 || ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || ser->type == PORT_STARTECH) return -EINVAL; return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,569
static _INLINE_ unsigned int read_option_register(struct mp_port *mtpt, int offset) { return inb(mtpt->option_base_addr + offset); }
+Info
0
static _INLINE_ unsigned int read_option_register(struct mp_port *mtpt, int offset) { return inb(mtpt->option_base_addr + offset); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,570
static _INLINE_ void receive_chars(struct mp_port *mtpt, int *status ) { struct tty_struct *tty = mtpt->port.info->tty; unsigned char lsr = *status; int max_count = 256; unsigned char ch; char flag; do { if ((lsr & UART_LSR_PE) && (mtpt->port.mdmode & MDMODE_ENABLE)) { ch = serial_inp(mtpt, UART_RX); } else if (lsr & UART_LSR_SPECIAL) { flag = 0; ch = serial_inp(mtpt, UART_RX); if (lsr & UART_LSR_BI) { mtpt->port.icount.brk++; flag = TTY_BREAK; if (sb_uart_handle_break(&mtpt->port)) goto ignore_char; } if (lsr & UART_LSR_PE) { mtpt->port.icount.parity++; flag = TTY_PARITY; } if (lsr & UART_LSR_FE) { mtpt->port.icount.frame++; flag = TTY_FRAME; } if (lsr & UART_LSR_OE) { mtpt->port.icount.overrun++; flag = TTY_OVERRUN; } tty_insert_flip_char(tty, ch, flag); } else { ch = serial_inp(mtpt, UART_RX); tty_insert_flip_char(tty, ch, 0); } ignore_char: lsr = serial_inp(mtpt, UART_LSR); } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); tty_flip_buffer_push(tty); }
+Info
0
static _INLINE_ void receive_chars(struct mp_port *mtpt, int *status ) { struct tty_struct *tty = mtpt->port.info->tty; unsigned char lsr = *status; int max_count = 256; unsigned char ch; char flag; do { if ((lsr & UART_LSR_PE) && (mtpt->port.mdmode & MDMODE_ENABLE)) { ch = serial_inp(mtpt, UART_RX); } else if (lsr & UART_LSR_SPECIAL) { flag = 0; ch = serial_inp(mtpt, UART_RX); if (lsr & UART_LSR_BI) { mtpt->port.icount.brk++; flag = TTY_BREAK; if (sb_uart_handle_break(&mtpt->port)) goto ignore_char; } if (lsr & UART_LSR_PE) { mtpt->port.icount.parity++; flag = TTY_PARITY; } if (lsr & UART_LSR_FE) { mtpt->port.icount.frame++; flag = TTY_FRAME; } if (lsr & UART_LSR_OE) { mtpt->port.icount.overrun++; flag = TTY_OVERRUN; } tty_insert_flip_char(tty, ch, flag); } else { ch = serial_inp(mtpt, UART_RX); tty_insert_flip_char(tty, ch, 0); } ignore_char: lsr = serial_inp(mtpt, UART_LSR); } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); tty_flip_buffer_push(tty); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,571
static int sb1053a_get_interface(struct mp_port *mtpt, int port_num) { unsigned long option_base_addr = mtpt->option_base_addr; unsigned int interface = 0; switch (port_num) { case 0: case 1: /* set GPO[1:0] = 00 */ outb(0x00, option_base_addr + MP_OPTR_GPODR); break; case 2: case 3: /* set GPO[1:0] = 01 */ outb(0x01, option_base_addr + MP_OPTR_GPODR); break; case 4: case 5: /* set GPO[1:0] = 10 */ outb(0x02, option_base_addr + MP_OPTR_GPODR); break; default: break; } port_num &= 0x1; /* get interface */ interface = inb(option_base_addr + MP_OPTR_IIR0 + port_num); /* set GPO[1:0] = 11 */ outb(0x03, option_base_addr + MP_OPTR_GPODR); return (interface); }
+Info
0
static int sb1053a_get_interface(struct mp_port *mtpt, int port_num) { unsigned long option_base_addr = mtpt->option_base_addr; unsigned int interface = 0; switch (port_num) { case 0: case 1: /* set GPO[1:0] = 00 */ outb(0x00, option_base_addr + MP_OPTR_GPODR); break; case 2: case 3: /* set GPO[1:0] = 01 */ outb(0x01, option_base_addr + MP_OPTR_GPODR); break; case 4: case 5: /* set GPO[1:0] = 10 */ outb(0x02, option_base_addr + MP_OPTR_GPODR); break; default: break; } port_num &= 0x1; /* get interface */ interface = inb(option_base_addr + MP_OPTR_IIR0 + port_num); /* set GPO[1:0] = 11 */ outb(0x03, option_base_addr + MP_OPTR_GPODR); return (interface); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,572
static int sb1054_set_register(struct sb_uart_port *port, int page, int reg, int value) { int lcr = 0; int mcr = 0; int ret = 0; if( page <= 0) { printk(" page 0 can not use this fuction\n"); return -1; } switch(page) { case 1: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_DLAB); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; case 2: mcr = SB105X_GET_MCR(port); SB105X_PUT_MCR(port, mcr | SB105X_MCR_P2S); SB105X_PUT_REG(port,reg,value); SB105X_PUT_MCR(port, mcr); ret = 1; break; case 3: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_BF); SB105X_PUT_PSR(port, SB105X_PSR_P3KEY); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; case 4: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_BF); SB105X_PUT_PSR(port, SB105X_PSR_P4KEY); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; default: printk(" error invalid page number \n"); return -1; } return ret; }
+Info
0
static int sb1054_set_register(struct sb_uart_port *port, int page, int reg, int value) { int lcr = 0; int mcr = 0; int ret = 0; if( page <= 0) { printk(" page 0 can not use this fuction\n"); return -1; } switch(page) { case 1: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_DLAB); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; case 2: mcr = SB105X_GET_MCR(port); SB105X_PUT_MCR(port, mcr | SB105X_MCR_P2S); SB105X_PUT_REG(port,reg,value); SB105X_PUT_MCR(port, mcr); ret = 1; break; case 3: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_BF); SB105X_PUT_PSR(port, SB105X_PSR_P3KEY); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; case 4: lcr = SB105X_GET_LCR(port); SB105X_PUT_LCR(port, lcr | SB105X_LCR_BF); SB105X_PUT_PSR(port, SB105X_PSR_P4KEY); SB105X_PUT_REG(port,reg,value); SB105X_PUT_LCR(port, lcr); ret = 1; break; default: printk(" error invalid page number \n"); return -1; } return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,573
static _INLINE_ unsigned int serial_in(struct mp_port *mtpt, int offset) { return inb(mtpt->port.iobase + offset); }
+Info
0
static _INLINE_ unsigned int serial_in(struct mp_port *mtpt, int offset) { return inb(mtpt->port.iobase + offset); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,574
static int serial_link_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; int ret, irq_flags = mtpt->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; spin_lock_irq(&i->lock); if (i->head) { list_add(&mtpt->list, i->head); spin_unlock_irq(&i->lock); ret = 0; } else { INIT_LIST_HEAD(&mtpt->list); i->head = &mtpt->list; spin_unlock_irq(&i->lock); ret = request_irq(mtpt->port.irq, multi_interrupt, irq_flags, "serial", i); if (ret < 0) serial_do_unlink(i, mtpt); } return ret; }
+Info
0
static int serial_link_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; int ret, irq_flags = mtpt->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; spin_lock_irq(&i->lock); if (i->head) { list_add(&mtpt->list, i->head); spin_unlock_irq(&i->lock); ret = 0; } else { INIT_LIST_HEAD(&mtpt->list); i->head = &mtpt->list; spin_unlock_irq(&i->lock); ret = request_irq(mtpt->port.irq, multi_interrupt, irq_flags, "serial", i); if (ret < 0) serial_do_unlink(i, mtpt); } return ret; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,575
static void serial_unlink_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; if (list_empty(i->head)) { free_irq(mtpt->port.irq, i); } serial_do_unlink(i, mtpt); }
+Info
0
static void serial_unlink_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; if (list_empty(i->head)) { free_irq(mtpt->port.irq, i); } serial_do_unlink(i, mtpt); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,576
static int set_auto_rts(struct sb_uart_port *port, int status) { int atr_status = 0; #if 0 int efr_status = 0; efr_status = sb1054_get_register(port, PAGE_3, SB105X_EFR); if(status == ENABLE) efr_status |= SB105X_EFR_ARTS; else efr_status &= ~SB105X_EFR_ARTS; sb1054_set_register(port,PAGE_3,SB105X_EFR,efr_status); efr_status = sb1054_get_register(port, PAGE_3, SB105X_EFR); #endif atr_status = sb1054_get_register(port, PAGE_3, SB105X_ATR); switch(status) { case RS422PTP: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_A80); break; case RS422MD: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; case RS485NE: atr_status = (SB105X_ATR_RCMS) | (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; case RS485ECHO: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; } sb1054_set_register(port,PAGE_3,SB105X_ATR,atr_status); atr_status = sb1054_get_register(port, PAGE_3, SB105X_ATR); return atr_status; }
+Info
0
static int set_auto_rts(struct sb_uart_port *port, int status) { int atr_status = 0; #if 0 int efr_status = 0; efr_status = sb1054_get_register(port, PAGE_3, SB105X_EFR); if(status == ENABLE) efr_status |= SB105X_EFR_ARTS; else efr_status &= ~SB105X_EFR_ARTS; sb1054_set_register(port,PAGE_3,SB105X_EFR,efr_status); efr_status = sb1054_get_register(port, PAGE_3, SB105X_EFR); #endif atr_status = sb1054_get_register(port, PAGE_3, SB105X_ATR); switch(status) { case RS422PTP: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_A80); break; case RS422MD: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; case RS485NE: atr_status = (SB105X_ATR_RCMS) | (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; case RS485ECHO: atr_status = (SB105X_ATR_TPS) | (SB105X_ATR_TCMS) | (SB105X_ATR_A80); break; } sb1054_set_register(port,PAGE_3,SB105X_ATR,atr_status); atr_status = sb1054_get_register(port, PAGE_3, SB105X_ATR); return atr_status; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,577
static int set_deep_fifo(struct sb_uart_port *port, int status) { int afr_status = 0; afr_status = sb1054_get_register(port, PAGE_4, SB105X_AFR); if(status == ENABLE) { afr_status |= SB105X_AFR_AFEN; } else { afr_status &= ~SB105X_AFR_AFEN; } sb1054_set_register(port,PAGE_4,SB105X_AFR,afr_status); sb1054_set_register(port,PAGE_4,SB105X_TTR,ttr[port->line]); sb1054_set_register(port,PAGE_4,SB105X_RTR,rtr[port->line]); afr_status = sb1054_get_register(port, PAGE_4, SB105X_AFR); return afr_status; }
+Info
0
static int set_deep_fifo(struct sb_uart_port *port, int status) { int afr_status = 0; afr_status = sb1054_get_register(port, PAGE_4, SB105X_AFR); if(status == ENABLE) { afr_status |= SB105X_AFR_AFEN; } else { afr_status &= ~SB105X_AFR_AFEN; } sb1054_set_register(port,PAGE_4,SB105X_AFR,afr_status); sb1054_set_register(port,PAGE_4,SB105X_TTR,ttr[port->line]); sb1054_set_register(port,PAGE_4,SB105X_RTR,rtr[port->line]); afr_status = sb1054_get_register(port, PAGE_4, SB105X_AFR); return afr_status; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,578
static int set_multidrop_addr(struct sb_uart_port *port, unsigned int addr) { sb1054_set_register(port, PAGE_3, SB105X_XOFF2, addr); return 0; }
+Info
0
static int set_multidrop_addr(struct sb_uart_port *port, unsigned int addr) { sb1054_set_register(port, PAGE_3, SB105X_XOFF2, addr); return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,579
static int set_multidrop_mode(struct sb_uart_port *port, unsigned int mode) { int mdr = SB105XA_MDR_NPS; if (mode & MDMODE_ENABLE) { mdr |= SB105XA_MDR_MDE; } if (1) //(mode & MDMODE_AUTO) { int efr = 0; mdr |= SB105XA_MDR_AME; efr = sb1054_get_register(port, PAGE_3, SB105X_EFR); efr |= SB105X_EFR_SCD; sb1054_set_register(port, PAGE_3, SB105X_EFR, efr); } sb1054_set_register(port, PAGE_1, SB105XA_MDR, mdr); port->mdmode &= ~0x6; port->mdmode |= mode; printk("[%d] multidrop init: %x\n", port->line, port->mdmode); return 0; }
+Info
0
static int set_multidrop_mode(struct sb_uart_port *port, unsigned int mode) { int mdr = SB105XA_MDR_NPS; if (mode & MDMODE_ENABLE) { mdr |= SB105XA_MDR_MDE; } if (1) //(mode & MDMODE_AUTO) { int efr = 0; mdr |= SB105XA_MDR_AME; efr = sb1054_get_register(port, PAGE_3, SB105X_EFR); efr |= SB105X_EFR_SCD; sb1054_set_register(port, PAGE_3, SB105X_EFR, efr); } sb1054_set_register(port, PAGE_1, SB105XA_MDR, mdr); port->mdmode &= ~0x6; port->mdmode |= mode; printk("[%d] multidrop init: %x\n", port->line, port->mdmode); return 0; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,580
static _INLINE_ void transmit_chars(struct mp_port *mtpt) { struct circ_buf *xmit = &mtpt->port.info->xmit; int count; if (mtpt->port.x_char) { serial_outp(mtpt, UART_TX, mtpt->port.x_char); mtpt->port.icount.tx++; mtpt->port.x_char = 0; return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&mtpt->port)) { multi_stop_tx(&mtpt->port); return; } count = uart_circ_chars_pending(xmit); if(count > mtpt->port.fifosize) { count = mtpt->port.fifosize; } printk("[%d] mdmode: %x\n", mtpt->port.line, mtpt->port.mdmode); do { #if 0 /* check multi-drop mode */ if ((mtpt->port.mdmode & (MDMODE_ENABLE | MDMODE_ADDR)) == (MDMODE_ENABLE | MDMODE_ADDR)) { printk("send address\n"); /* send multi-drop address */ serial_out(mtpt, UART_SCR, xmit->buf[xmit->tail]); } else #endif { serial_out(mtpt, UART_TX, xmit->buf[xmit->tail]); } xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); mtpt->port.icount.tx++; } while (--count > 0); }
+Info
0
static _INLINE_ void transmit_chars(struct mp_port *mtpt) { struct circ_buf *xmit = &mtpt->port.info->xmit; int count; if (mtpt->port.x_char) { serial_outp(mtpt, UART_TX, mtpt->port.x_char); mtpt->port.icount.tx++; mtpt->port.x_char = 0; return; } if (uart_circ_empty(xmit) || uart_tx_stopped(&mtpt->port)) { multi_stop_tx(&mtpt->port); return; } count = uart_circ_chars_pending(xmit); if(count > mtpt->port.fifosize) { count = mtpt->port.fifosize; } printk("[%d] mdmode: %x\n", mtpt->port.line, mtpt->port.mdmode); do { #if 0 /* check multi-drop mode */ if ((mtpt->port.mdmode & (MDMODE_ENABLE | MDMODE_ADDR)) == (MDMODE_ENABLE | MDMODE_ADDR)) { printk("send address\n"); /* send multi-drop address */ serial_out(mtpt, UART_SCR, xmit->buf[xmit->tail]); } else #endif { serial_out(mtpt, UART_TX, xmit->buf[xmit->tail]); } xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); mtpt->port.icount.tx++; } while (--count > 0); }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,581
static struct sb_uart_state *uart_get(struct uart_driver *drv, int line) { struct sb_uart_state *state; MP_MUTEX_LOCK(mp_mutex); state = drv->state + line; if (mutex_lock_interruptible(&state->mutex)) { state = ERR_PTR(-ERESTARTSYS); goto out; } state->count++; if (!state->port) { state->count--; MP_STATE_UNLOCK(state); state = ERR_PTR(-ENXIO); goto out; } if (!state->info) { state->info = kmalloc(sizeof(struct sb_uart_info), GFP_KERNEL); if (state->info) { memset(state->info, 0, sizeof(struct sb_uart_info)); init_waitqueue_head(&state->info->open_wait); init_waitqueue_head(&state->info->delta_msr_wait); state->port->info = state->info; tasklet_init(&state->info->tlet, mp_tasklet_action, (unsigned long)state); } else { state->count--; MP_STATE_UNLOCK(state); state = ERR_PTR(-ENOMEM); } } out: MP_MUTEX_UNLOCK(mp_mutex); return state; }
+Info
0
static struct sb_uart_state *uart_get(struct uart_driver *drv, int line) { struct sb_uart_state *state; MP_MUTEX_LOCK(mp_mutex); state = drv->state + line; if (mutex_lock_interruptible(&state->mutex)) { state = ERR_PTR(-ERESTARTSYS); goto out; } state->count++; if (!state->port) { state->count--; MP_STATE_UNLOCK(state); state = ERR_PTR(-ENXIO); goto out; } if (!state->info) { state->info = kmalloc(sizeof(struct sb_uart_info), GFP_KERNEL); if (state->info) { memset(state->info, 0, sizeof(struct sb_uart_info)); init_waitqueue_head(&state->info->open_wait); init_waitqueue_head(&state->info->delta_msr_wait); state->port->info = state->info; tasklet_init(&state->info->tlet, mp_tasklet_action, (unsigned long)state); } else { state->count--; MP_STATE_UNLOCK(state); state = ERR_PTR(-ENOMEM); } } out: MP_MUTEX_UNLOCK(mp_mutex); return state; }
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) { - struct serial_icounter_struct icount; + struct serial_icounter_struct icount = {}; struct sb_uart_icount cnow; struct sb_uart_port *port = state->port;
CWE-200
null
null
23,582
static int bcm_char_open(struct inode *inode, struct file *filp) { struct bcm_mini_adapter *Adapter = NULL; struct bcm_tarang_data *pTarang = NULL; Adapter = GET_BCM_ADAPTER(gblpnetdev); pTarang = kzalloc(sizeof(struct bcm_tarang_data), GFP_KERNEL); if (!pTarang) return -ENOMEM; pTarang->Adapter = Adapter; pTarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB); down(&Adapter->RxAppControlQueuelock); pTarang->next = Adapter->pTarangs; Adapter->pTarangs = pTarang; up(&Adapter->RxAppControlQueuelock); /* Store the Adapter structure */ filp->private_data = pTarang; /* Start Queuing the control response Packets */ atomic_inc(&Adapter->ApplicationRunning); nonseekable_open(inode, filp); return 0; }
+Info
0
static int bcm_char_open(struct inode *inode, struct file *filp) { struct bcm_mini_adapter *Adapter = NULL; struct bcm_tarang_data *pTarang = NULL; Adapter = GET_BCM_ADAPTER(gblpnetdev); pTarang = kzalloc(sizeof(struct bcm_tarang_data), GFP_KERNEL); if (!pTarang) return -ENOMEM; pTarang->Adapter = Adapter; pTarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB); down(&Adapter->RxAppControlQueuelock); pTarang->next = Adapter->pTarangs; Adapter->pTarangs = pTarang; up(&Adapter->RxAppControlQueuelock); /* Store the Adapter structure */ filp->private_data = pTarang; /* Start Queuing the control response Packets */ atomic_inc(&Adapter->ApplicationRunning); nonseekable_open(inode, filp); return 0; }
@@ -1960,6 +1960,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); + memset(&DevInfo, 0, sizeof(DevInfo)); DevInfo.MaxRDMBufferSize = BUFFER_4K; DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; DevInfo.u32RxAlignmentCorrection = 0;
CWE-200
null
null
23,583
static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) { struct bcm_tarang_data *pTarang = filp->private_data; struct bcm_mini_adapter *Adapter = pTarang->Adapter; struct sk_buff *Packet = NULL; ssize_t PktLen = 0; int wait_ret_val = 0; unsigned long ret = 0; wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue, (pTarang->RxAppControlHead || Adapter->device_removed)); if ((wait_ret_val == -ERESTARTSYS)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n"); return wait_ret_val; } if (Adapter->device_removed) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Device Removed... Killing the Apps...\n"); return -ENODEV; } if (FALSE == Adapter->fw_download_done) return -EACCES; down(&Adapter->RxAppControlQueuelock); if (pTarang->RxAppControlHead) { Packet = pTarang->RxAppControlHead; DEQUEUEPACKET(pTarang->RxAppControlHead, pTarang->RxAppControlTail); pTarang->AppCtrlQueueLen--; } up(&Adapter->RxAppControlQueuelock); if (Packet) { PktLen = Packet->len; ret = copy_to_user(buf, Packet->data, min_t(size_t, PktLen, size)); if (ret) { dev_kfree_skb(Packet); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Returning from copy to user failure\n"); return -EFAULT; } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read %zd Bytes From Adapter packet = %p by process %d!\n", PktLen, Packet, current->pid); dev_kfree_skb(Packet); } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<\n"); return PktLen; }
+Info
0
static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) { struct bcm_tarang_data *pTarang = filp->private_data; struct bcm_mini_adapter *Adapter = pTarang->Adapter; struct sk_buff *Packet = NULL; ssize_t PktLen = 0; int wait_ret_val = 0; unsigned long ret = 0; wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue, (pTarang->RxAppControlHead || Adapter->device_removed)); if ((wait_ret_val == -ERESTARTSYS)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n"); return wait_ret_val; } if (Adapter->device_removed) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Device Removed... Killing the Apps...\n"); return -ENODEV; } if (FALSE == Adapter->fw_download_done) return -EACCES; down(&Adapter->RxAppControlQueuelock); if (pTarang->RxAppControlHead) { Packet = pTarang->RxAppControlHead; DEQUEUEPACKET(pTarang->RxAppControlHead, pTarang->RxAppControlTail); pTarang->AppCtrlQueueLen--; } up(&Adapter->RxAppControlQueuelock); if (Packet) { PktLen = Packet->len; ret = copy_to_user(buf, Packet->data, min_t(size_t, PktLen, size)); if (ret) { dev_kfree_skb(Packet); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Returning from copy to user failure\n"); return -EFAULT; } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read %zd Bytes From Adapter packet = %p by process %d!\n", PktLen, Packet, current->pid); dev_kfree_skb(Packet); } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<\n"); return PktLen; }
@@ -1960,6 +1960,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); + memset(&DevInfo, 0, sizeof(DevInfo)); DevInfo.MaxRDMBufferSize = BUFFER_4K; DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; DevInfo.u32RxAlignmentCorrection = 0;
CWE-200
null
null
23,584
int register_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) return Adapter->major; Adapter->major = register_chrdev(0, DEV_NAME, &bcm_fops); if (Adapter->major < 0) { pr_err(DRV_NAME ": could not created character device\n"); return Adapter->major; } Adapter->pstCreatedClassDevice = device_create(bcm_class, NULL, MKDEV(Adapter->major, 0), Adapter, DEV_NAME); if (IS_ERR(Adapter->pstCreatedClassDevice)) { pr_err(DRV_NAME ": class device create failed\n"); unregister_chrdev(Adapter->major, DEV_NAME); return PTR_ERR(Adapter->pstCreatedClassDevice); } return 0; }
+Info
0
int register_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) return Adapter->major; Adapter->major = register_chrdev(0, DEV_NAME, &bcm_fops); if (Adapter->major < 0) { pr_err(DRV_NAME ": could not created character device\n"); return Adapter->major; } Adapter->pstCreatedClassDevice = device_create(bcm_class, NULL, MKDEV(Adapter->major, 0), Adapter, DEV_NAME); if (IS_ERR(Adapter->pstCreatedClassDevice)) { pr_err(DRV_NAME ": class device create failed\n"); unregister_chrdev(Adapter->major, DEV_NAME); return PTR_ERR(Adapter->pstCreatedClassDevice); } return 0; }
@@ -1960,6 +1960,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); + memset(&DevInfo, 0, sizeof(DevInfo)); DevInfo.MaxRDMBufferSize = BUFFER_4K; DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; DevInfo.u32RxAlignmentCorrection = 0;
CWE-200
null
null
23,585
void unregister_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) { device_destroy(bcm_class, MKDEV(Adapter->major, 0)); unregister_chrdev(Adapter->major, DEV_NAME); } }
+Info
0
void unregister_control_device_interface(struct bcm_mini_adapter *Adapter) { if (Adapter->major > 0) { device_destroy(bcm_class, MKDEV(Adapter->major, 0)); unregister_chrdev(Adapter->major, DEV_NAME); } }
@@ -1960,6 +1960,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); + memset(&DevInfo, 0, sizeof(DevInfo)); DevInfo.MaxRDMBufferSize = BUFFER_4K; DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; DevInfo.u32RxAlignmentCorrection = 0;
CWE-200
null
null
23,586
int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_driver_identity"); DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver identity structure. */ if (urq->len < sizeof(lp->driverIdentity)) { urq->len = sizeof(lp->driverIdentity); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverIdentity)); if (result != 0) { urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } /* Copy the driver identity into the user's buffer. */ urq->result = UIL_SUCCESS; copy_to_user(urq->data, &(lp->driverIdentity), sizeof(lp->driverIdentity)); DBG_LEAVE(DbgInfo); return result; } /* cfg_driver_identity */
DoS Overflow
0
int cfg_driver_identity(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_driver_identity"); DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver identity structure. */ if (urq->len < sizeof(lp->driverIdentity)) { urq->len = sizeof(lp->driverIdentity); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverIdentity)); if (result != 0) { urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } /* Copy the driver identity into the user's buffer. */ urq->result = UIL_SUCCESS; copy_to_user(urq->data, &(lp->driverIdentity), sizeof(lp->driverIdentity)); DBG_LEAVE(DbgInfo); return result; } /* cfg_driver_identity */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,587
int cfg_driver_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("cfg_driver_info"); DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver information buffer */ if (urq->len < sizeof(lp->driverInfo)) { urq->len = sizeof(lp->driverInfo); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverInfo)); if (result != 0) { urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat; /* Copy the driver information into the user's buffer. */ urq->result = UIL_SUCCESS; copy_to_user(urq->data, &(lp->driverInfo), sizeof(lp->driverInfo)); DBG_LEAVE(DbgInfo); return result; } /* cfg_driver_info */
DoS Overflow
0
int cfg_driver_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("cfg_driver_info"); DBG_ENTER(DbgInfo); /* Make sure that user buffer can handle the driver information buffer */ if (urq->len < sizeof(lp->driverInfo)) { urq->len = sizeof(lp->driverInfo); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user buffer. */ result = verify_area(VERIFY_WRITE, urq->data, sizeof(lp->driverInfo)); if (result != 0) { urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat; /* Copy the driver information into the user's buffer. */ urq->result = UIL_SUCCESS; copy_to_user(urq->data, &(lp->driverInfo), sizeof(lp->driverInfo)); DBG_LEAVE(DbgInfo); return result; } /* cfg_driver_info */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,588
int wvlan_get_netname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; wvName_t *pName; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_netname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current network name */ lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CUR_SSID; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; memcpy(extra, pName->name, pName->length); } else { ret = -EFAULT; } wl_unlock(lp, &flags); DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_netname */
DoS Overflow
0
int wvlan_get_netname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; wvName_t *pName; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_netname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current network name */ lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CUR_SSID; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; memcpy(extra, pName->name, pName->length); } else { ret = -EFAULT; } wl_unlock(lp, &flags); DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_netname */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,589
int wvlan_get_porttype(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; hcf_16 *pPortType; __u32 *pData = (__u32 *)extra; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_porttype"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current port type */ lp->ltvRecord.len = 1 + (sizeof(*pPortType) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pPortType = (hcf_16 *)&(lp->ltvRecord.u.u32); *pData = CNV_LITTLE_TO_INT(*pPortType); } else { ret = -EFAULT; } wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_porttype */
DoS Overflow
0
int wvlan_get_porttype(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; hcf_16 *pPortType; __u32 *pData = (__u32 *)extra; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_porttype"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current port type */ lp->ltvRecord.len = 1 + (sizeof(*pPortType) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pPortType = (hcf_16 *)&(lp->ltvRecord.u.u32); *pData = CNV_LITTLE_TO_INT(*pPortType); } else { ret = -EFAULT; } wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_porttype */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,590
int wvlan_get_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; wvName_t *pName; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_station_nickname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current station name */ lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CNF_OWN_NAME; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; memcpy(extra, pName->name, pName->length); } else { ret = -EFAULT; } wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_station_nickname */
DoS Overflow
0
int wvlan_get_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; int status = -1; wvName_t *pName; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_get_station_nickname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Get the current station name */ lp->ltvRecord.len = 1 + (sizeof(*pName) / sizeof(hcf_16)); lp->ltvRecord.typ = CFG_CNF_OWN_NAME; status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); if (status == HCF_SUCCESS) { pName = (wvName_t *)&(lp->ltvRecord.u.u32); memset(extra, '\0', HCF_MAX_NAME_LEN); wrqu->data.length = pName->length; memcpy(extra, pName->name, pName->length); } else { ret = -EFAULT; } wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; } /* wvlan_get_station_nickname */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,591
int wvlan_rts(struct rtsreq *rrq, __u32 io_base) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_rts"); DBG_ENTER(DbgInfo); DBG_PRINT("io_base: 0x%08x\n", io_base); switch (rrq->typ) { case WL_IOCTL_RTS_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_READ\n"); rrq->data[0] = IN_PORT_WORD(io_base + rrq->reg); DBG_TRACE(DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; case WL_IOCTL_RTS_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_WRITE\n"); OUT_PORT_WORD(io_base + rrq->reg, rrq->data[0]); DBG_TRACE(DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; case WL_IOCTL_RTS_BATCH_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_READ\n"); IN_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); DBG_TRACE(DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; case WL_IOCTL_RTS_BATCH_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_WRITE\n"); OUT_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); DBG_TRACE(DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; default: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ); ioctl_ret = -EOPNOTSUPP; break; } DBG_LEAVE(DbgInfo); return ioctl_ret; } /* wvlan_rts */
DoS Overflow
0
int wvlan_rts(struct rtsreq *rrq, __u32 io_base) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_rts"); DBG_ENTER(DbgInfo); DBG_PRINT("io_base: 0x%08x\n", io_base); switch (rrq->typ) { case WL_IOCTL_RTS_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_READ\n"); rrq->data[0] = IN_PORT_WORD(io_base + rrq->reg); DBG_TRACE(DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; case WL_IOCTL_RTS_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_WRITE\n"); OUT_PORT_WORD(io_base + rrq->reg, rrq->data[0]); DBG_TRACE(DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT(rrq->data[0])); break; case WL_IOCTL_RTS_BATCH_READ: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_READ\n"); IN_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); DBG_TRACE(DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; case WL_IOCTL_RTS_BATCH_WRITE: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_WRITE\n"); OUT_PORT_STRING_16(io_base + rrq->reg, rrq->data, rrq->len); DBG_TRACE(DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof(__u16)); break; default: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ); ioctl_ret = -EOPNOTSUPP; break; } DBG_LEAVE(DbgInfo); return ioctl_ret; } /* wvlan_rts */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,592
int wvlan_set_netname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_set_netname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); memset(lp->NetworkName, 0, sizeof(lp->NetworkName)); memcpy(lp->NetworkName, extra, wrqu->data.length); /* Commit the adapter parameters */ wl_apply(lp); wl_unlock(lp, &flags); DBG_LEAVE(DbgInfo); return ret; } /* wvlan_set_netname */
DoS Overflow
0
int wvlan_set_netname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_set_netname"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); memset(lp->NetworkName, 0, sizeof(lp->NetworkName)); memcpy(lp->NetworkName, extra, wrqu->data.length); /* Commit the adapter parameters */ wl_apply(lp); wl_unlock(lp, &flags); DBG_LEAVE(DbgInfo); return ret; } /* wvlan_set_netname */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,593
int wvlan_set_porttype(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; hcf_16 portType; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_set_porttype"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Validate the new value */ portType = *((__u32 *)extra); if (!((portType == 1) || (portType == 3))) { ret = -EINVAL; goto out_unlock; } lp->PortType = portType; /* Commit the adapter parameters */ wl_apply(lp); out_unlock: wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; }
DoS Overflow
0
int wvlan_set_porttype(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct wl_private *lp = wl_priv(dev); unsigned long flags; int ret = 0; hcf_16 portType; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_set_porttype"); DBG_ENTER(DbgInfo); wl_lock(lp, &flags); /* Validate the new value */ portType = *((__u32 *)extra); if (!((portType == 1) || (portType == 3))) { ret = -EINVAL; goto out_unlock; } lp->PortType = portType; /* Commit the adapter parameters */ wl_apply(lp); out_unlock: wl_unlock(lp, &flags); /* out: */ DBG_LEAVE(DbgInfo); return ret; }
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,594
int wvlan_uil(struct uilreq *urq, struct wl_private *lp) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil"); DBG_ENTER(DbgInfo); switch (urq->command) { case UIL_FUN_CONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_CONNECT\n"); ioctl_ret = wvlan_uil_connect(urq, lp); break; case UIL_FUN_DISCONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_DISCONNECT\n"); ioctl_ret = wvlan_uil_disconnect(urq, lp); break; case UIL_FUN_ACTION: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n"); ioctl_ret = wvlan_uil_action(urq, lp); break; case UIL_FUN_SEND_DIAG_MSG: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_SEND_DIAG_MSG\n"); ioctl_ret = wvlan_uil_send_diag_msg(urq, lp); break; case UIL_FUN_GET_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_GET_INFO\n"); ioctl_ret = wvlan_uil_get_info(urq, lp); break; case UIL_FUN_PUT_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_PUT_INFO\n"); ioctl_ret = wvlan_uil_put_info(urq, lp); break; default: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command); ioctl_ret = -EOPNOTSUPP; break; } DBG_LEAVE(DbgInfo); return ioctl_ret; } /* wvlan_uil */
DoS Overflow
0
int wvlan_uil(struct uilreq *urq, struct wl_private *lp) { int ioctl_ret = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil"); DBG_ENTER(DbgInfo); switch (urq->command) { case UIL_FUN_CONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_CONNECT\n"); ioctl_ret = wvlan_uil_connect(urq, lp); break; case UIL_FUN_DISCONNECT: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_DISCONNECT\n"); ioctl_ret = wvlan_uil_disconnect(urq, lp); break; case UIL_FUN_ACTION: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n"); ioctl_ret = wvlan_uil_action(urq, lp); break; case UIL_FUN_SEND_DIAG_MSG: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_SEND_DIAG_MSG\n"); ioctl_ret = wvlan_uil_send_diag_msg(urq, lp); break; case UIL_FUN_GET_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_GET_INFO\n"); ioctl_ret = wvlan_uil_get_info(urq, lp); break; case UIL_FUN_PUT_INFO: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_PUT_INFO\n"); ioctl_ret = wvlan_uil_put_info(urq, lp); break; default: DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command); ioctl_ret = -EOPNOTSUPP; break; } DBG_LEAVE(DbgInfo); return ioctl_ret; } /* wvlan_uil */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,595
int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp) { int result = 0; ltv_t *ltv; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_action"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { /* Make sure there's an LTV in the request buffer */ ltv = (ltv_t *)urq->data; if (ltv != NULL) { /* Switch on the Type field of the LTV contained in the request buffer */ switch (ltv->typ) { case UIL_ACT_BLOCK: DBG_TRACE(DbgInfo, "UIL_ACT_BLOCK\n"); result = wvlan_uil_block(urq, lp); break; case UIL_ACT_UNBLOCK: DBG_TRACE(DbgInfo, "UIL_ACT_UNBLOCK\n"); result = wvlan_uil_unblock(urq, lp); break; case UIL_ACT_SCAN: DBG_TRACE(DbgInfo, "UIL_ACT_SCAN\n"); urq->result = hcf_action(&(lp->hcfCtx), MDD_ACT_SCAN); break; case UIL_ACT_APPLY: DBG_TRACE(DbgInfo, "UIL_ACT_APPLY\n"); urq->result = wl_apply(lp); break; case UIL_ACT_RESET: DBG_TRACE(DbgInfo, "UIL_ACT_RESET\n"); urq->result = wl_go(lp); break; default: DBG_WARNING(DbgInfo, "Unknown action code: 0x%x\n", ltv->typ); break; } } else { DBG_ERROR(DbgInfo, "Bad LTV for this action\n"); urq->result = UIL_ERR_LEN; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_action */
DoS Overflow
0
int wvlan_uil_action(struct uilreq *urq, struct wl_private *lp) { int result = 0; ltv_t *ltv; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_action"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { /* Make sure there's an LTV in the request buffer */ ltv = (ltv_t *)urq->data; if (ltv != NULL) { /* Switch on the Type field of the LTV contained in the request buffer */ switch (ltv->typ) { case UIL_ACT_BLOCK: DBG_TRACE(DbgInfo, "UIL_ACT_BLOCK\n"); result = wvlan_uil_block(urq, lp); break; case UIL_ACT_UNBLOCK: DBG_TRACE(DbgInfo, "UIL_ACT_UNBLOCK\n"); result = wvlan_uil_unblock(urq, lp); break; case UIL_ACT_SCAN: DBG_TRACE(DbgInfo, "UIL_ACT_SCAN\n"); urq->result = hcf_action(&(lp->hcfCtx), MDD_ACT_SCAN); break; case UIL_ACT_APPLY: DBG_TRACE(DbgInfo, "UIL_ACT_APPLY\n"); urq->result = wl_apply(lp); break; case UIL_ACT_RESET: DBG_TRACE(DbgInfo, "UIL_ACT_RESET\n"); urq->result = wl_go(lp); break; default: DBG_WARNING(DbgInfo, "Unknown action code: 0x%x\n", ltv->typ); break; } } else { DBG_ERROR(DbgInfo, "Bad LTV for this action\n"); urq->result = UIL_ERR_LEN; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_action */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,596
int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_disconnect"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (lp->flags & WVLAN2_UIL_CONNECTED) { lp->flags &= ~WVLAN2_UIL_CONNECTED; /* if (lp->flags & WVLAN2_UIL_BUSY) { lp->flags &= ~WVLAN2_UIL_BUSY; netif_start_queue(lp->dev); } */ } urq->hcfCtx = NULL; urq->result = UIL_SUCCESS; } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_disconnect */
DoS Overflow
0
int wvlan_uil_disconnect(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_disconnect"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (lp->flags & WVLAN2_UIL_CONNECTED) { lp->flags &= ~WVLAN2_UIL_CONNECTED; /* if (lp->flags & WVLAN2_UIL_BUSY) { lp->flags &= ~WVLAN2_UIL_BUSY; netif_start_queue(lp->dev); } */ } urq->hcfCtx = NULL; urq->result = UIL_SUCCESS; } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_disconnect */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,597
int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; int i; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_get_info"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if ((urq->data != NULL) && (urq->len != 0)) { ltv_t *pLtv; bool_t ltvAllocated = FALSE; /* Make sure that we have at least a command and length */ if (urq->len < (sizeof(hcf_16) * 2)) { urq->len = sizeof(lp->ltvRecord); DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n"); DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user's LTV record header. */ result = verify_area(VERIFY_READ, urq->data, sizeof(hcf_16) * 2); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n"); urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } /* Get only the command and length information. */ result = copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2); /* Make sure the incoming LTV record length is within the bounds of the IOCTL length. */ if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) { DBG_ERROR(DbgInfo, "Incoming LTV too big\n"); urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Determine if hcf_get_info() is needed or not */ switch (lp->ltvRecord.typ) { case CFG_NIC_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof(lp->NICIdentity)); break; case CFG_PRI_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof(lp->PrimaryIdentity)); break; case CFG_AP_MODE: DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n"); lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP; break; /* case CFG_DRV_INFO: */ case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: /* TODO: determine if we're going to support these */ urq->result = UIL_FAILURE; break; case CFG_DRV_INFO: DBG_TRACE(DbgInfo, "Intercept CFG_DRV_INFO\n"); result = cfg_driver_info(urq, lp); break; case CFG_DRV_IDENTITY: DBG_TRACE(DbgInfo, "Intercept CFG_DRV_IDENTITY\n"); result = cfg_driver_identity(urq, lp); break; case CFG_IFB: /* IFB can be a security hole */ if (!capable(CAP_NET_ADMIN)) { result = -EPERM; break; } /* Else fall through to the default */ case CFG_FW_IDENTITY: /* For Hermes-1, this is cached */ default: /* Verify the user buffer */ result = verify_area(VERIFY_WRITE, urq->data, urq->len); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n"); urq->result = UIL_FAILURE; break; } /* If the requested length is greater than the size of our local LTV record, try to allocate it from the kernel stack. Otherwise, we just use our local LTV record. */ if (urq->len > sizeof(lp->ltvRecord)) { pLtv = kmalloc(urq->len, GFP_KERNEL); if (pLtv != NULL) { ltvAllocated = TRUE; /* Copy the command/length information into the new buffer. */ memcpy(pLtv, &(lp->ltvRecord), sizeof(hcf_16) * 2); } else { urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_ERROR(DbgInfo, "kmalloc FAILED\n"); DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); result = -ENOMEM; break; } } else { pLtv = &(lp->ltvRecord); } wl_act_int_off(lp); urq->result = hcf_get_info(&(lp->hcfCtx), (LTVP) pLtv); wl_act_int_on(lp); /* Copy the LTV into the user's buffer. */ /*copy_to_user(urq->data, pLtv, urq->len); */ /*if(ltvAllocated) { kfree(pLtv); }*/ /* urq->result = UIL_SUCCESS; */ break; } /* Handle endian conversion of special fields */ switch (lp->ltvRecord.typ) { /* simple int gets just need the first hcf_16 byte flipped */ case CFG_CNF_PORT_TYPE: case CFG_CNF_OWN_CHANNEL: case CFG_CNF_OWN_ATIM_WINDOW: case CFG_CNF_SYSTEM_SCALE: case CFG_CNF_MAX_DATA_LEN: case CFG_CNF_PM_ENABLED: case CFG_CNF_MCAST_RX: case CFG_CNF_MAX_SLEEP_DURATION: case CFG_CNF_HOLDOVER_DURATION: case CFG_CNF_OWN_DTIM_PERIOD: case CFG_CNF_MCAST_PM_BUF: case CFG_CNF_REJECT_ANY: case CFG_CNF_ENCRYPTION: case CFG_CNF_AUTHENTICATION: case CFG_CNF_EXCL_UNENCRYPTED: case CFG_CNF_INTRA_BSS_RELAY: case CFG_CNF_MICRO_WAVE: case CFG_CNF_LOAD_BALANCING: case CFG_CNF_MEDIUM_DISTRIBUTION: #ifdef WARP case CFG_CNF_TX_POW_LVL: case CFG_CNF_CONNECTION_CNTL: case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence Behavior */ /*case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ #endif /* HERMES25 */ case CFG_CREATE_IBSS: case CFG_RTS_THRH: case CFG_PROMISCUOUS_MODE: /*case CFG_WAKE_ON_LAN: */ case CFG_RTS_THRH0: case CFG_RTS_THRH1: case CFG_RTS_THRH2: case CFG_RTS_THRH3: case CFG_RTS_THRH4: case CFG_RTS_THRH5: case CFG_RTS_THRH6: case CFG_TX_RATE_CNTL0: case CFG_TX_RATE_CNTL1: case CFG_TX_RATE_CNTL2: case CFG_TX_RATE_CNTL3: case CFG_TX_RATE_CNTL4: case CFG_TX_RATE_CNTL5: case CFG_TX_RATE_CNTL6: case CFG_TX_KEY_ID: case CFG_TICK_TIME: case CFG_MAX_LOAD_TIME: case CFG_NIC_TEMP_TYPE: case CFG_PORT_STAT: case CFG_CUR_TX_RATE: case CFG_CUR_BEACON_INTERVAL: case CFG_PROTOCOL_RSP_TIME: case CFG_CUR_SHORT_RETRY_LIMIT: case CFG_CUR_LONG_RETRY_LIMIT: case CFG_MAX_TX_LIFETIME: case CFG_MAX_RX_LIFETIME: case CFG_CF_POLLABLE: case CFG_PRIVACY_OPT_IMPLEMENTED: /* case CFG_CURRENT_REMOTE_RATES: */ /* case CFG_CURRENT_USED_RATES: */ /* case CFG_CURRENT_SYSTEM_SCALE: */ /* case CFG_CURRENT_TX_RATE1: */ /* case CFG_CURRENT_TX_RATE2: */ /* case CFG_CURRENT_TX_RATE3: */ /* case CFG_CURRENT_TX_RATE4: */ /* case CFG_CURRENT_TX_RATE5: */ /* case CFG_CURRENT_TX_RATE6: */ case CFG_PHY_TYPE: case CFG_CUR_CHANNEL: /* case CFG_CURRENT_POWER_STATE: */ /* case CFG_CCAMODE: */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); */ /* break; */ /* name string gets just need the first hcf_16 byte flipped (length of string) */ case CFG_CNF_OWN_SSID: case CFG_CNF_OWN_NAME: /* case CNF_DESIRED_SSID: */ case CFG_DESIRED_SSID: case CFG_SCAN_SSID: case CFG_CUR_SSID: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); break; /* non-length counted strings need no byte flipping */ case CFG_CNF_OWN_MAC_ADDR: /* this case is no longer valid: CFG_CNF_WDS_ADDR */ case CFG_CNF_WDS_ADDR1: case CFG_CNF_WDS_ADDR2: case CFG_CNF_WDS_ADDR3: case CFG_CNF_WDS_ADDR4: case CFG_CNF_WDS_ADDR5: case CFG_CNF_WDS_ADDR6: case CFG_GROUP_ADDR: case CFG_NIC_SERIAL_NUMBER: case CFG_CUR_BSSID: case CFG_NIC_MAC_ADDR: case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */ break; /* case CFG_CNF_COUNTRY_INFO: */ /* special case, see page 75 of 022486, Rev C. */ /* case CFG_CURRENT_COUNTRY_INFO: */ /* special case, see page 101 of 022486, Rev C. */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); for(i = 4; i < lp->ltvRecord.len; i++) { lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); } break; */ case CFG_DEFAULT_KEYS: { CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0]; pKeys[0].len = CNV_INT_TO_LITTLE(pKeys[0].len); pKeys[1].len = CNV_INT_TO_LITTLE(pKeys[1].len); pKeys[2].len = CNV_INT_TO_LITTLE(pKeys[2].len); pKeys[3].len = CNV_INT_TO_LITTLE(pKeys[3].len); } break; case CFG_CNF_MCAST_RATE: case CFG_TX_RATE_CNTL: case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */ case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */ lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); break; case CFG_DL_BUF: case CFG_NIC_IDENTITY: case CFG_COMMS_QUALITY: case CFG_PCF_INFO: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); break; case CFG_FW_IDENTITY: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); break; /* case CFG_HSI_SUP_RANGE: */ case CFG_NIC_MFI_SUP_RANGE: case CFG_NIC_CFI_SUP_RANGE: case CFG_NIC_PROFILE: case CFG_FW_SUP_RANGE: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[4]); break; case CFG_MFI_ACT_RANGES_STA: case CFG_CFI_ACT_RANGES_STA: case CFG_CUR_SCALE_THRH: case CFG_AUTHENTICATION_ALGORITHMS: for (i = 0; i < (lp->ltvRecord.len - 1); i++) lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); break; /* done at init time, and endian handled then */ case CFG_PRI_IDENTITY: break; case CFG_MB_INFO: /* wvlanEndianTranslateMailbox(pLtv); */ break; /* MSF and HCF RIDS */ case CFG_IFB: case CFG_DRV_INFO: case CFG_AP_MODE: case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: default: break; } /* Copy the LTV into the user's buffer. */ copy_to_user(urq->data, &(lp->ltvRecord), urq->len); if (ltvAllocated) kfree(&(lp->ltvRecord)); urq->result = UIL_SUCCESS; } else { urq->result = UIL_FAILURE; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_get_info */
DoS Overflow
0
int wvlan_uil_get_info(struct uilreq *urq, struct wl_private *lp) { int result = 0; int i; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_get_info"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if ((urq->data != NULL) && (urq->len != 0)) { ltv_t *pLtv; bool_t ltvAllocated = FALSE; /* Make sure that we have at least a command and length */ if (urq->len < (sizeof(hcf_16) * 2)) { urq->len = sizeof(lp->ltvRecord); DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n"); DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Verify the user's LTV record header. */ result = verify_area(VERIFY_READ, urq->data, sizeof(hcf_16) * 2); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n"); urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } /* Get only the command and length information. */ result = copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2); /* Make sure the incoming LTV record length is within the bounds of the IOCTL length. */ if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) { DBG_ERROR(DbgInfo, "Incoming LTV too big\n"); urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_LEAVE(DbgInfo); return result; } /* Determine if hcf_get_info() is needed or not */ switch (lp->ltvRecord.typ) { case CFG_NIC_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof(lp->NICIdentity)); break; case CFG_PRI_IDENTITY: memcpy(&lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof(lp->PrimaryIdentity)); break; case CFG_AP_MODE: DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n"); lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP; break; /* case CFG_DRV_INFO: */ case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: /* TODO: determine if we're going to support these */ urq->result = UIL_FAILURE; break; case CFG_DRV_INFO: DBG_TRACE(DbgInfo, "Intercept CFG_DRV_INFO\n"); result = cfg_driver_info(urq, lp); break; case CFG_DRV_IDENTITY: DBG_TRACE(DbgInfo, "Intercept CFG_DRV_IDENTITY\n"); result = cfg_driver_identity(urq, lp); break; case CFG_IFB: /* IFB can be a security hole */ if (!capable(CAP_NET_ADMIN)) { result = -EPERM; break; } /* Else fall through to the default */ case CFG_FW_IDENTITY: /* For Hermes-1, this is cached */ default: /* Verify the user buffer */ result = verify_area(VERIFY_WRITE, urq->data, urq->len); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n"); urq->result = UIL_FAILURE; break; } /* If the requested length is greater than the size of our local LTV record, try to allocate it from the kernel stack. Otherwise, we just use our local LTV record. */ if (urq->len > sizeof(lp->ltvRecord)) { pLtv = kmalloc(urq->len, GFP_KERNEL); if (pLtv != NULL) { ltvAllocated = TRUE; /* Copy the command/length information into the new buffer. */ memcpy(pLtv, &(lp->ltvRecord), sizeof(hcf_16) * 2); } else { urq->len = sizeof(lp->ltvRecord); urq->result = UIL_ERR_LEN; DBG_ERROR(DbgInfo, "kmalloc FAILED\n"); DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n"); result = -ENOMEM; break; } } else { pLtv = &(lp->ltvRecord); } wl_act_int_off(lp); urq->result = hcf_get_info(&(lp->hcfCtx), (LTVP) pLtv); wl_act_int_on(lp); /* Copy the LTV into the user's buffer. */ /*copy_to_user(urq->data, pLtv, urq->len); */ /*if(ltvAllocated) { kfree(pLtv); }*/ /* urq->result = UIL_SUCCESS; */ break; } /* Handle endian conversion of special fields */ switch (lp->ltvRecord.typ) { /* simple int gets just need the first hcf_16 byte flipped */ case CFG_CNF_PORT_TYPE: case CFG_CNF_OWN_CHANNEL: case CFG_CNF_OWN_ATIM_WINDOW: case CFG_CNF_SYSTEM_SCALE: case CFG_CNF_MAX_DATA_LEN: case CFG_CNF_PM_ENABLED: case CFG_CNF_MCAST_RX: case CFG_CNF_MAX_SLEEP_DURATION: case CFG_CNF_HOLDOVER_DURATION: case CFG_CNF_OWN_DTIM_PERIOD: case CFG_CNF_MCAST_PM_BUF: case CFG_CNF_REJECT_ANY: case CFG_CNF_ENCRYPTION: case CFG_CNF_AUTHENTICATION: case CFG_CNF_EXCL_UNENCRYPTED: case CFG_CNF_INTRA_BSS_RELAY: case CFG_CNF_MICRO_WAVE: case CFG_CNF_LOAD_BALANCING: case CFG_CNF_MEDIUM_DISTRIBUTION: #ifdef WARP case CFG_CNF_TX_POW_LVL: case CFG_CNF_CONNECTION_CNTL: case CFG_CNF_OWN_BEACON_INTERVAL: /* Own Beacon Interval */ case CFG_COEXISTENSE_BEHAVIOUR: /* Coexistence Behavior */ /*case CFG_CNF_RX_ALL_GROUP_ADDRESS: */ #endif /* HERMES25 */ case CFG_CREATE_IBSS: case CFG_RTS_THRH: case CFG_PROMISCUOUS_MODE: /*case CFG_WAKE_ON_LAN: */ case CFG_RTS_THRH0: case CFG_RTS_THRH1: case CFG_RTS_THRH2: case CFG_RTS_THRH3: case CFG_RTS_THRH4: case CFG_RTS_THRH5: case CFG_RTS_THRH6: case CFG_TX_RATE_CNTL0: case CFG_TX_RATE_CNTL1: case CFG_TX_RATE_CNTL2: case CFG_TX_RATE_CNTL3: case CFG_TX_RATE_CNTL4: case CFG_TX_RATE_CNTL5: case CFG_TX_RATE_CNTL6: case CFG_TX_KEY_ID: case CFG_TICK_TIME: case CFG_MAX_LOAD_TIME: case CFG_NIC_TEMP_TYPE: case CFG_PORT_STAT: case CFG_CUR_TX_RATE: case CFG_CUR_BEACON_INTERVAL: case CFG_PROTOCOL_RSP_TIME: case CFG_CUR_SHORT_RETRY_LIMIT: case CFG_CUR_LONG_RETRY_LIMIT: case CFG_MAX_TX_LIFETIME: case CFG_MAX_RX_LIFETIME: case CFG_CF_POLLABLE: case CFG_PRIVACY_OPT_IMPLEMENTED: /* case CFG_CURRENT_REMOTE_RATES: */ /* case CFG_CURRENT_USED_RATES: */ /* case CFG_CURRENT_SYSTEM_SCALE: */ /* case CFG_CURRENT_TX_RATE1: */ /* case CFG_CURRENT_TX_RATE2: */ /* case CFG_CURRENT_TX_RATE3: */ /* case CFG_CURRENT_TX_RATE4: */ /* case CFG_CURRENT_TX_RATE5: */ /* case CFG_CURRENT_TX_RATE6: */ case CFG_PHY_TYPE: case CFG_CUR_CHANNEL: /* case CFG_CURRENT_POWER_STATE: */ /* case CFG_CCAMODE: */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); */ /* break; */ /* name string gets just need the first hcf_16 byte flipped (length of string) */ case CFG_CNF_OWN_SSID: case CFG_CNF_OWN_NAME: /* case CNF_DESIRED_SSID: */ case CFG_DESIRED_SSID: case CFG_SCAN_SSID: case CFG_CUR_SSID: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); break; /* non-length counted strings need no byte flipping */ case CFG_CNF_OWN_MAC_ADDR: /* this case is no longer valid: CFG_CNF_WDS_ADDR */ case CFG_CNF_WDS_ADDR1: case CFG_CNF_WDS_ADDR2: case CFG_CNF_WDS_ADDR3: case CFG_CNF_WDS_ADDR4: case CFG_CNF_WDS_ADDR5: case CFG_CNF_WDS_ADDR6: case CFG_GROUP_ADDR: case CFG_NIC_SERIAL_NUMBER: case CFG_CUR_BSSID: case CFG_NIC_MAC_ADDR: case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */ break; /* case CFG_CNF_COUNTRY_INFO: */ /* special case, see page 75 of 022486, Rev C. */ /* case CFG_CURRENT_COUNTRY_INFO: */ /* special case, see page 101 of 022486, Rev C. */ /* lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); for(i = 4; i < lp->ltvRecord.len; i++) { lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); } break; */ case CFG_DEFAULT_KEYS: { CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0]; pKeys[0].len = CNV_INT_TO_LITTLE(pKeys[0].len); pKeys[1].len = CNV_INT_TO_LITTLE(pKeys[1].len); pKeys[2].len = CNV_INT_TO_LITTLE(pKeys[2].len); pKeys[3].len = CNV_INT_TO_LITTLE(pKeys[3].len); } break; case CFG_CNF_MCAST_RATE: case CFG_TX_RATE_CNTL: case CFG_SUPPORTED_RATE_SET_CNTL: /* Supported Rate Set Control */ case CFG_BASIC_RATE_SET_CNTL: /* Basic Rate Set Control */ lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); break; case CFG_DL_BUF: case CFG_NIC_IDENTITY: case CFG_COMMS_QUALITY: case CFG_PCF_INFO: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); break; case CFG_FW_IDENTITY: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); break; /* case CFG_HSI_SUP_RANGE: */ case CFG_NIC_MFI_SUP_RANGE: case CFG_NIC_CFI_SUP_RANGE: case CFG_NIC_PROFILE: case CFG_FW_SUP_RANGE: lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[0]); lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[1]); lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[2]); lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[3]); lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[4]); break; case CFG_MFI_ACT_RANGES_STA: case CFG_CFI_ACT_RANGES_STA: case CFG_CUR_SCALE_THRH: case CFG_AUTHENTICATION_ALGORITHMS: for (i = 0; i < (lp->ltvRecord.len - 1); i++) lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE(lp->ltvRecord.u.u16[i]); break; /* done at init time, and endian handled then */ case CFG_PRI_IDENTITY: break; case CFG_MB_INFO: /* wvlanEndianTranslateMailbox(pLtv); */ break; /* MSF and HCF RIDS */ case CFG_IFB: case CFG_DRV_INFO: case CFG_AP_MODE: case CFG_ENCRYPT_STRING: case CFG_COUNTRY_STRING: case CFG_DRIVER_ENABLE: case CFG_WOLAS_ENABLE: default: break; } /* Copy the LTV into the user's buffer. */ copy_to_user(urq->data, &(lp->ltvRecord), urq->len); if (ltvAllocated) kfree(&(lp->ltvRecord)); urq->result = UIL_SUCCESS; } else { urq->result = UIL_FAILURE; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_get_info */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,598
int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp) { int result = 0; DESC_STRCT Descp[1]; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_send_diag_msg"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (capable(CAP_NET_ADMIN)) { if ((urq->data != NULL) && (urq->len != 0)) { if (lp->hcfCtx.IFB_RscInd != 0) { u_char *data; /* Verify the user buffer */ result = verify_area(VERIFY_READ, urq->data, urq->len); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area failed, result: %d\n", result); urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } data = kmalloc(urq->len, GFP_KERNEL); if (data != NULL) { memset(Descp, 0, sizeof(DESC_STRCT)); memcpy(data, urq->data, urq->len); Descp[0].buf_addr = (wci_bufp)data; Descp[0].BUF_CNT = urq->len; Descp[0].next_desc_addr = 0; /* terminate list */ hcf_send_msg(&(lp->hcfCtx), &Descp[0], HCF_PORT_0); kfree(data); } else { DBG_ERROR(DbgInfo, "ENOMEM\n"); urq->result = UIL_FAILURE; result = -ENOMEM; DBG_LEAVE(DbgInfo); return result; } } else { urq->result = UIL_ERR_BUSY; } } else { urq->result = UIL_FAILURE; } } else { DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_send_diag_msg */
DoS Overflow
0
int wvlan_uil_send_diag_msg(struct uilreq *urq, struct wl_private *lp) { int result = 0; DESC_STRCT Descp[1]; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_send_diag_msg"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (capable(CAP_NET_ADMIN)) { if ((urq->data != NULL) && (urq->len != 0)) { if (lp->hcfCtx.IFB_RscInd != 0) { u_char *data; /* Verify the user buffer */ result = verify_area(VERIFY_READ, urq->data, urq->len); if (result != 0) { DBG_ERROR(DbgInfo, "verify_area failed, result: %d\n", result); urq->result = UIL_FAILURE; DBG_LEAVE(DbgInfo); return result; } data = kmalloc(urq->len, GFP_KERNEL); if (data != NULL) { memset(Descp, 0, sizeof(DESC_STRCT)); memcpy(data, urq->data, urq->len); Descp[0].buf_addr = (wci_bufp)data; Descp[0].BUF_CNT = urq->len; Descp[0].next_desc_addr = 0; /* terminate list */ hcf_send_msg(&(lp->hcfCtx), &Descp[0], HCF_PORT_0); kfree(data); } else { DBG_ERROR(DbgInfo, "ENOMEM\n"); urq->result = UIL_FAILURE; result = -ENOMEM; DBG_LEAVE(DbgInfo); return result; } } else { urq->result = UIL_ERR_BUSY; } } else { urq->result = UIL_FAILURE; } } else { DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_send_diag_msg */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null
23,599
int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_unblock"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (capable(CAP_NET_ADMIN)) { if (lp->flags & WVLAN2_UIL_BUSY) { lp->flags &= ~WVLAN2_UIL_BUSY; netif_wake_queue(lp->dev); WL_WDS_NETIF_WAKE_QUEUE(lp); } } else { DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_unblock */
DoS Overflow
0
int wvlan_uil_unblock(struct uilreq *urq, struct wl_private *lp) { int result = 0; /*------------------------------------------------------------------------*/ DBG_FUNC("wvlan_uil_unblock"); DBG_ENTER(DbgInfo); if (urq->hcfCtx == &(lp->hcfCtx)) { if (capable(CAP_NET_ADMIN)) { if (lp->flags & WVLAN2_UIL_BUSY) { lp->flags &= ~WVLAN2_UIL_BUSY; netif_wake_queue(lp->dev); WL_WDS_NETIF_WAKE_QUEUE(lp); } } else { DBG_ERROR(DbgInfo, "EPERM\n"); urq->result = UIL_FAILURE; result = -EPERM; } } else { DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n"); urq->result = UIL_ERR_WRONG_IFB; } DBG_LEAVE(DbgInfo); return result; } /* wvlan_uil_unblock */
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) ltv_t *pLtv; bool_t ltvAllocated = FALSE; ENCSTRCT sEncryption; + size_t len; #ifdef USE_WDS hcf_16 hcfPort = HCF_PORT_0; @@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) break; case CFG_CNF_OWN_NAME: memset(lp->StationName, 0, sizeof(lp->StationName)); - memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); + strlcpy(lp->StationName, &pLtv->u.u8[2], len); pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); break; case CFG_CNF_LOAD_BALANCING: @@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, { struct wl_private *lp = wl_priv(dev); unsigned long flags; + size_t len; int ret = 0; /*------------------------------------------------------------------------*/ @@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, wl_lock(lp, &flags); memset(lp->StationName, 0, sizeof(lp->StationName)); - - memcpy(lp->StationName, extra, wrqu->data.length); + len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); + strlcpy(lp->StationName, extra, len); /* Commit the adapter parameters */ wl_apply(lp);
CWE-119
null
null