From 1b9faf5e66bae8428a4ccdc1447d5399d1014581 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 8 Jul 2012 01:37:38 +0000 Subject: drivers/isdn/mISDN/stack.c: remove invalid reference to list iterator variable If list_for_each_entry, etc complete a traversal of the list, the iterator variable ends up pointing to an address at an offset from the list head, and not a meaningful structure. Thus this value should not be used after the end of the iterator. The dereferences are just deleted from the debugging statement. This problem was found using Coccinelle (http://coccinelle.lip6.fr/). Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- drivers/isdn/mISDN/stack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index 1a0ae4445ff..5f21f629b7a 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c @@ -135,8 +135,8 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb) skb = NULL; else if (*debug & DEBUG_SEND_ERR) printk(KERN_DEBUG - "%s ch%d mgr prim(%x) addr(%x) err %d\n", - __func__, ch->nr, hh->prim, ch->addr, ret); + "%s mgr prim(%x) err %d\n", + __func__, hh->prim, ret); } out: mutex_unlock(&st->lmutex); -- cgit v1.2.3 From 6ba6047bf99cf4ade4f63b6b3d97cc3ad763b678 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Sat, 14 Jul 2012 23:11:55 +0000 Subject: gigaset: silence GCC warning for unused 'format_ie' Building Gigaset's CAPI support without Gigaset's debugging enabled triggers this GCC warning: 'format_ie' defined but not used [-Wunused-function] Silence this warning by wrapping format_ie() in an "#ifdef CONFIG_GIGASET_DEBUG" and "#endif" pair. Signed-off-by: Paul Bolle Signed-off-by: David S. Miller --- drivers/isdn/gigaset/capi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/isdn') diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 27e4a3e21d6..68452b768da 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c @@ -288,6 +288,7 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, * format CAPI IE as string */ +#ifdef CONFIG_GIGASET_DEBUG static const char *format_ie(const char *ie) { static char result[3 * MAX_FMT_IE_LEN]; @@ -313,6 +314,7 @@ static const char *format_ie(const char *ie) *--pout = 0; return result; } +#endif /* * emit DATA_B3_CONF message -- cgit v1.2.3 From 5b999fd04af95e2cb624aaf6a7637561572b2d96 Mon Sep 17 00:00:00 2001 From: Karsten Keil Date: Thu, 12 Jul 2012 07:01:10 +0000 Subject: ISDN: Add check for return value of pnp_activate_dev() pnp_activate_dev() return value needs to be checked to make sure that following calls calls to the PNP functions do work correctly. Fix for report #44491 on bugzilla.kernel.org. Signed-off-by: Karsten Keil Signed-off-by: David S. Miller --- drivers/isdn/hisax/isurf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/isdn') diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c index ea271721529..c1530fe248c 100644 --- a/drivers/isdn/hisax/isurf.c +++ b/drivers/isdn/hisax/isurf.c @@ -231,6 +231,11 @@ setup_isurf(struct IsdnCard *card) } pnp_disable_dev(pnp_d); err = pnp_activate_dev(pnp_d); + if (err < 0) { + pr_warn("%s: pnp_activate_dev ret=%d\n", + __func__, err); + return 0; + } cs->hw.isurf.reset = pnp_port_start(pnp_d, 0); cs->hw.isurf.phymem = pnp_mem_start(pnp_d, 1); cs->irq = pnp_irq(pnp_d, 0); -- cgit v1.2.3 From 2ae4605d738ede6d94a481a30972fadfdaf73549 Mon Sep 17 00:00:00 2001 From: Karsten Keil Date: Thu, 12 Jul 2012 22:59:46 +0000 Subject: ISDN: Add check for usb_alloc_urb() result usb_alloc_urb() return value needs to be checked to avoid later NULL pointer access. Reported by rucsoftsec@gmail.com via bugzilla.kernel.org #44601. Signed-off-by: Karsten Keil Signed-off-by: David S. Miller --- drivers/isdn/hardware/mISDN/hfcsusb.c | 18 +++++++++++++----- drivers/isdn/hisax/hfc_usb.c | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index c65c3440cd7..114f3bcba1b 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -2084,13 +2084,21 @@ hfcsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) /* create the control pipes needed for register access */ hw->ctrl_in_pipe = usb_rcvctrlpipe(hw->dev, 0); hw->ctrl_out_pipe = usb_sndctrlpipe(hw->dev, 0); + + driver_info = (struct hfcsusb_vdata *) + hfcsusb_idtab[vend_idx].driver_info; + hw->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); + if (!hw->ctrl_urb) { + pr_warn("%s: No memory for control urb\n", + driver_info->vend_name); + kfree(hw); + return -ENOMEM; + } - driver_info = - (struct hfcsusb_vdata *)hfcsusb_idtab[vend_idx].driver_info; - printk(KERN_DEBUG "%s: %s: detected \"%s\" (%s, if=%d alt=%d)\n", - hw->name, __func__, driver_info->vend_name, - conf_str[small_match], ifnum, alt_used); + pr_info("%s: %s: detected \"%s\" (%s, if=%d alt=%d)\n", + hw->name, __func__, driver_info->vend_name, + conf_str[small_match], ifnum, alt_used); if (setup_instance(hw, dev->dev.parent)) return -EIO; diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 84f9c810307..849a8075268 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c @@ -1483,13 +1483,21 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) usb_rcvctrlpipe(context->dev, 0); context->ctrl_out_pipe = usb_sndctrlpipe(context->dev, 0); + + driver_info = (hfcsusb_vdata *) + hfcusb_idtab[vend_idx].driver_info; + context->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); - driver_info = - (hfcsusb_vdata *) hfcusb_idtab[vend_idx]. - driver_info; - printk(KERN_INFO "HFC-S USB: detected \"%s\"\n", - driver_info->vend_name); + if (!context->ctrl_urb) { + pr_warn("%s: No memory for control urb\n", + driver_info->vend_name); + kfree(context); + return -ENOMEM; + } + + pr_info("HFC-S USB: detected \"%s\"\n", + driver_info->vend_name); DBG(HFCUSB_DBG_INIT, "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d), E-Channel(%d)", -- cgit v1.2.3 From b41a9a66f67817f8acd85bd650e012a14da39faa Mon Sep 17 00:00:00 2001 From: Karsten Keil Date: Sun, 29 Jul 2012 07:15:13 +0000 Subject: mISDN: Bugfix only few bytes are transfered on a connection The test for the fillempty condition was wrong in one place. Changed the variable to the right boolean type. Signed-off-by: Karsten Keil Signed-off-by: David S. Miller --- drivers/isdn/hardware/mISDN/avmfritz.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c index c08fc605e56..fa6ca473372 100644 --- a/drivers/isdn/hardware/mISDN/avmfritz.c +++ b/drivers/isdn/hardware/mISDN/avmfritz.c @@ -449,7 +449,8 @@ hdlc_fill_fifo(struct bchannel *bch) { struct fritzcard *fc = bch->hw; struct hdlc_hw *hdlc; - int count, fs, cnt = 0, idx, fillempty = 0; + int count, fs, cnt = 0, idx; + bool fillempty = false; u8 *p; u32 *ptr, val, addr; @@ -462,7 +463,7 @@ hdlc_fill_fifo(struct bchannel *bch) return; count = fs; p = bch->fill; - fillempty = 1; + fillempty = true; } else { count = bch->tx_skb->len - bch->tx_idx; if (count <= 0) @@ -477,7 +478,7 @@ hdlc_fill_fifo(struct bchannel *bch) hdlc->ctrl.sr.cmd |= HDLC_CMD_XME; } ptr = (u32 *)p; - if (fillempty) { + if (!fillempty) { pr_debug("%s.B%d: %d/%d/%d", fc->name, bch->nr, count, bch->tx_idx, bch->tx_skb->len); bch->tx_idx += count; -- cgit v1.2.3