format string usage clean ups
Subsystems (42)
v2 cover format string usage clean ups
Version 2 of this series. Originally: https://lkml.org/lkml/2013/6/6/614
Changes:
- "power: ensure event is not used as format string" taken by maintainer.
- "kobject: sanitize argument for format string" taken by maintainer.
- "device: avoid format string in dev_set_name" fixed for newly uncovered additional error in format string.
- "isdn: clean up debug format string usage" accidental dev_set_name revert chunk dropped.
Thanks,
-Kees
PATCH v2 1/6 block: do not pass disk names as format strings
Disk names may contain arbitrary strings, so they must not be interpreted as format strings. It seems that only md allows arbitrary strings to be used for disk names, but this could allow for a local memory corruption from uid 0 into ring 0.
CVE-2013-2851
--- block/genhd.c | 2 +- drivers/block/nbd.c | 3 ++- drivers/scsi/osd/osd_uld.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
block/genhd.c +1 -1
@@ -512,7 +512,7 @@ static void register_disk(struct gendisk *disk) ddev->parent = disk->driverfs_dev; -dev_set_name (ddev, disk->disk_name); +dev_set_name (ddev,"%s" , disk->disk_name);/* delay uevents, until we scanned partition table */ dev_set_uevent_suppress (ddev,1 );
drivers/block/nbd.c +2 -1
@@ -714,7 +714,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,else blk_queue_flush (nbd->disk->queue,0 ); - thread =kthread_create (nbd_thread, nbd, nbd->disk->disk_name); + thread =kthread_create (nbd_thread, nbd,"%s" , + nbd->disk->disk_name);if (IS_ERR (thread)) {mutex_lock (&nbd->tx_lock);return PTR_ERR (thread);
drivers/scsi/osd/osd_uld.c +1 -1
@@ -485,7 +485,7 @@ static int osd_probe(struct device *dev) oud->class_dev.class = &osd_uld_class; oud->class_dev.parent = dev; oud->class_dev.release = __remove; - error =dev_set_name (&oud->class_dev, disk->disk_name); + error =dev_set_name (&oud->class_dev,"%s" , disk->disk_name);if (error) {OSD_ERR ("dev_set_name failed => %d\n" , error); goto err_put_cdev;
Signature · 1 line
1.7.9.5
PATCH v2 2/6 crypto: sanitize argument for format string
In reply to Kees CookThe template lookup interface does not provide a way to use format strings, so make sure that the interface cannot be abused accidentally.
--- crypto/algapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/algapi.c +2 -1
@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)struct crypto_template *crypto_lookup_template (const char *name) { -return try_then_request_module (__crypto_lookup_template (name), name); +return try_then_request_module (__crypto_lookup_template (name),"%s" , + name); }EXPORT_SYMBOL_GPL (crypto_lookup_template);
Signature · 1 line
1.7.9.5
PATCH v2 3/6 device: avoid format string in dev_set_name
In reply to Kees CookCalling dev_set_name with a single paramter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents, including wrappers like device_create*() and bdi_register().
--- drivers/base/attribute_container.c | 2 +- drivers/devfreq/devfreq.c | 2 +- drivers/extcon/extcon-class.c | 2 +- drivers/hsi/hsi.c | 2 +- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-gd.c | 2 +- drivers/ide/ide-probe.c | 4 ++-- drivers/ide/ide-tape.c | 2 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/infiniband/hw/qib/qib_file_ops.c | 2 +- drivers/isdn/mISDN/dsp_pipeline.c | 2 +- drivers/mtd/mtdcore.c | 2 +- drivers/platform/x86/wmi.c | 2 +- drivers/scsi/sd.c | 2 +- drivers/staging/android/timed_output.c | 2 +- drivers/staging/dgrp/dgrp_sysfs.c | 2 +- drivers/uwb/lc-dev.c | 2 +- drivers/video/backlight/backlight.c | 2 +- drivers/video/backlight/lcd.c | 2 +- drivers/video/output.c | 2 +- drivers/xen/xenbus/xenbus_probe.c | 2 +- mm/backing-dev.c | 5 ++--- sound/sound_core.c | 2 +- 23 files changed, 25 insertions(+), 26 deletions(-)
drivers/base/attribute_container.c +1 -1
@@ -167,7 +167,7 @@ attribute_container_add_device(struct device *dev, ic->classdev.parent =get_device (dev); ic->classdev.class = cont->class; cont->class->dev_release = attribute_container_release; -dev_set_name (&ic->classdev,dev_name (dev)); +dev_set_name (&ic->classdev,"%s" ,dev_name (dev));if (fn)fn (cont, dev, &ic->classdev);else
drivers/devfreq/devfreq.c +1 -1
@@ -477,7 +477,7 @@ struct devfreq *devfreq_add_device(struct device *dev, GFP_KERNEL); devfreq->last_stat_updated = jiffies; -dev_set_name (&devfreq->dev,dev_name (dev)); +dev_set_name (&devfreq->dev,"%s" ,dev_name (dev)); err =device_register (&devfreq->dev);if (err) {put_device (&devfreq->dev);
drivers/extcon/extcon-class.c +1 -1
@@ -620,7 +620,7 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev) edev->dev->class = extcon_class; edev->dev->release = extcon_dev_release; -dev_set_name (edev->dev, edev->name ? edev->name :dev_name (dev)); +dev_set_name (edev->dev,"%s" , edev->name ? edev->name :dev_name (dev));if (edev->max_supported) {char buf[10 ];
drivers/hsi/hsi.c +1 -1
@@ -75,7 +75,7 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) cl->device.bus = &hsi_bus_type; cl->device.parent = &port->device; cl->device.release = hsi_client_release; -dev_set_name (&cl->device, info->name); +dev_set_name (&cl->device,"%s" , info->name); cl->device.platform_data = info->platform_data;if (info->archdata) cl->device.archdata = *info->archdata;
drivers/ide/ide-cd.c +1 -1
@@ -1756,7 +1756,7 @@ static int ide_cd_probe(ide_drive_t *drive) info->dev.parent = &drive->gendev; info->dev.release = ide_cd_release; -dev_set_name (&info->dev,dev_name (&drive->gendev)); +dev_set_name (&info->dev,"%s" ,dev_name (&drive->gendev));if (device_register (&info->dev)) goto out_free_disk;
drivers/ide/ide-gd.c +1 -1
@@ -392,7 +392,7 @@ static int ide_gd_probe(ide_drive_t *drive) idkp->dev.parent = &drive->gendev; idkp->dev.release = ide_disk_release; -dev_set_name (&idkp->dev,dev_name (&drive->gendev)); +dev_set_name (&idkp->dev,"%s" ,dev_name (&drive->gendev));if (device_register (&idkp->dev)) goto out_free_disk;
drivers/ide/ide-probe.c +2 -2
@@ -545,7 +545,7 @@ static int ide_register_port(ide_hwif_t *hwif)int ret;/* register with global device tree */ -dev_set_name (&hwif->gendev, hwif->name); +dev_set_name (&hwif->gendev,"%s" , hwif->name);dev_set_drvdata (&hwif->gendev, hwif);if (hwif->gendev.parent ==NULL ) hwif->gendev.parent = hwif->dev;
@@ -559,7 +559,7 @@ static int ide_register_port(ide_hwif_t *hwif) } hwif->portdev =device_create (ide_port_class, &hwif->gendev, -MKDEV (0 ,0 ), hwif, hwif->name); +MKDEV (0 ,0 ), hwif,"%s" , hwif->name);if (IS_ERR (hwif->portdev)) { ret =PTR_ERR (hwif->portdev);device_unregister (&hwif->gendev);
drivers/ide/ide-tape.c +1 -1
@@ -1985,7 +1985,7 @@ static int ide_tape_probe(ide_drive_t *drive) tape->dev.parent = &drive->gendev; tape->dev.release = ide_tape_release; -dev_set_name (&tape->dev,dev_name (&drive->gendev)); +dev_set_name (&tape->dev,"%s" ,dev_name (&drive->gendev));if (device_register (&tape->dev)) goto out_free_disk;
drivers/infiniband/core/sysfs.c +1 -1
@@ -813,7 +813,7 @@ int ib_device_register_sysfs(struct ib_device *device, class_dev->class = &ib_class; class_dev->parent = device->dma_device; -dev_set_name (class_dev, device->name); +dev_set_name (class_dev,"%s" , device->name);dev_set_drvdata (class_dev, device);INIT_LIST_HEAD (&device->port_list);
drivers/infiniband/hw/qib/qib_file_ops.c +1 -1
@@ -2208,7 +2208,7 @@ int qib_cdev_init(int minor, const char *name, goto err_cdev; } - device =device_create (qib_class,NULL , dev,NULL , name); + device =device_create (qib_class,NULL , dev,NULL ,"%s" , name);if (!IS_ERR (device)) goto done; ret =PTR_ERR (device);
drivers/isdn/mISDN/dsp_pipeline.c +1 -1
@@ -102,7 +102,7 @@ int mISDN_dsp_element_register(struct mISDN_dsp_element *elem) entry->dev.class = elements_class; entry->dev.release = mISDN_dsp_dev_release;dev_set_drvdata (&entry->dev, elem); -dev_set_name (&entry->dev, elem->name); +dev_set_name (&entry->dev,"%s" , elem->name); ret =device_register (&entry->dev);if (ret) { printk(KERN_ERR "%s: failed to register %s\n",
drivers/mtd/mtdcore.c +1 -1
@@ -1151,7 +1151,7 @@ static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name) ret =bdi_init (bdi);if (!ret) - ret =bdi_register (bdi,NULL , name); + ret =bdi_register (bdi,NULL ,"%s" , name);if (ret)bdi_destroy (bdi);
drivers/platform/x86/wmi.c +1 -1
@@ -743,7 +743,7 @@ static int wmi_create_device(const struct guid_block *gblock, wblock->dev.class = &wmi_class;wmi_gtoa (gblock->guid, guid_string); -dev_set_name (&wblock->dev, guid_string); +dev_set_name (&wblock->dev,"%s" , guid_string);dev_set_drvdata (&wblock->dev, wblock);
drivers/scsi/sd.c +1 -1
@@ -2931,7 +2931,7 @@ static int sd_probe(struct device *dev)device_initialize (&sdkp->dev); sdkp->dev.parent = dev; sdkp->dev.class = &sd_disk_class; -dev_set_name (&sdkp->dev,dev_name (dev)); +dev_set_name (&sdkp->dev,"%s" ,dev_name (dev));if (device_add (&sdkp->dev)) goto out_free_index;
drivers/staging/android/timed_output.c +1 -1
@@ -78,7 +78,7 @@ int timed_output_dev_register(struct timed_output_dev *tdev) tdev->index =atomic_inc_return (&device_count); tdev->dev =device_create (timed_output_class,NULL , -MKDEV (0 , tdev->index),NULL , tdev->name); +MKDEV (0 , tdev->index),NULL ,"%s" , tdev->name);if (IS_ERR (tdev->dev))return PTR_ERR (tdev->dev);
drivers/staging/dgrp/dgrp_sysfs.c +1 -1
@@ -273,7 +273,7 @@ void dgrp_create_node_class_sysfs_files(struct nd_struct *nd)sprintf (name,"node%ld" , nd->nd_major); nd->nd_class_dev =device_create (dgrp_class, dgrp_class_nodes_dev, -MKDEV (0 , nd->nd_major),NULL , name); +MKDEV (0 , nd->nd_major),NULL ,"%s" , name); ret =sysfs_create_group (&nd->nd_class_dev->kobj, &dgrp_node_attribute_group);
drivers/uwb/lc-dev.c +1 -1
@@ -440,7 +440,7 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce)uwb_dev_init (uwb_dev);/* This sets refcnt to one, we own it */ uwb_dev->mac_addr = *bce->mac_addr; uwb_dev->dev_addr = bce->dev_addr; -dev_set_name (&uwb_dev->dev, macbuf); +dev_set_name (&uwb_dev->dev,"%s" , macbuf); result =uwb_dev_add (uwb_dev, &rc->uwb_dev.dev, rc);if (result <0 ) { dev_err(dev, "new device %s: cannot instantiate device\n",
drivers/video/backlight/backlight.c +1 -1
@@ -304,7 +304,7 @@ struct backlight_device *backlight_device_register(const char *name, new_bd->dev.class = backlight_class; new_bd->dev.parent = parent; new_bd->dev.release = bl_device_release; -dev_set_name (&new_bd->dev, name); +dev_set_name (&new_bd->dev,"%s" , name);dev_set_drvdata (&new_bd->dev, devdata);/* Set default properties */
drivers/video/backlight/lcd.c +1 -1
@@ -219,7 +219,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent, new_ld->dev.class = lcd_class; new_ld->dev.parent = parent; new_ld->dev.release = lcd_device_release; -dev_set_name (&new_ld->dev, name); +dev_set_name (&new_ld->dev,"%s" , name);dev_set_drvdata (&new_ld->dev, devdata); rc =device_register (&new_ld->dev);
drivers/video/output.c +1 -1
@@ -97,7 +97,7 @@ struct output_device *video_output_register(const char *name, new_dev->props = op; new_dev->dev.class = &video_output_class; new_dev->dev.parent = dev; -dev_set_name (&new_dev->dev, name); +dev_set_name (&new_dev->dev,"%s" , name);dev_set_drvdata (&new_dev->dev, devdata); ret_code =device_register (&new_dev->dev);if (ret_code) {
drivers/xen/xenbus/xenbus_probe.c +1 -1
@@ -447,7 +447,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,if (err) goto fail; -dev_set_name (&xendev->dev, devname); +dev_set_name (&xendev->dev,"%s" , devname);/* Register with generic device framework. */ err =device_register (&xendev->dev);
mm/backing-dev.c +2 -3
@@ -515,7 +515,6 @@ EXPORT_SYMBOL(bdi_destroy);int bdi_setup_and_register (struct backing_dev_info *bdi,char *name,unsigned int cap) { -char tmp[32 ];int err; bdi->name = name;
@@ -524,8 +523,8 @@ int bdi_setup_and_register(struct backing_dev_info *bdi, char *name,if (err)return err; -sprintf (tmp,"%.28s%s" , name,"-%d" ); - err =bdi_register (bdi,NULL , tmp,atomic_long_inc_return (&bdi_seq)); + err =bdi_register (bdi,NULL ,"%.28s-%ld" , name, +atomic_long_inc_return (&bdi_seq));if (err) {bdi_destroy (bdi);return err;
sound/sound_core.c +1 -1
@@ -292,7 +292,7 @@ retry: }device_create (sound_class, dev,MKDEV (SOUND_MAJOR , s->unit_minor), -NULL , s->name+6 ); +NULL ,"%s" , s->name+6 );return s->unit_minor; fail:
Signature · 1 line
1.7.9.5
PATCH v2 4/6 workqueue: avoid format strings in names
In reply to Kees CookFor the workqueue creation interfaces that do not expect format strings, make sure they cannot accidently be parsed that way. Additionally, clean up calls made with a single parameter that would be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents.
--- crypto/pcrypt.c | 4 ++-- drivers/media/pci/cx18/cx18-driver.c | 2 +- drivers/message/i2o/driver.c | 4 ++-- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 +- drivers/net/wireless/rtlwifi/base.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 4 +--- drivers/pci/hotplug/shpchp_core.c | 3 +-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/qla4xxx/ql4_os.c | 4 ++-- drivers/scsi/scsi_transport_fc.c | 6 +++--- include/linux/workqueue.h | 7 ++++--- net/bluetooth/hci_core.c | 9 ++++----- net/mac80211/main.c | 2 +- 13 files changed, 24 insertions(+), 27 deletions(-)
crypto/pcrypt.c +2 -2
@@ -455,8 +455,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,get_online_cpus (); - pcrypt->wq =alloc_workqueue (name, -WQ_MEM_RECLAIM |WQ_CPU_INTENSIVE ,1 ); + pcrypt->wq =alloc_workqueue ("%s" ,WQ_MEM_RECLAIM |WQ_CPU_INTENSIVE , +1 , name);if (!pcrypt->wq) goto err;
drivers/media/pci/cx18/cx18-driver.c +1 -1
@@ -695,7 +695,7 @@ static int cx18_create_in_workq(struct cx18 *cx) {snprintf (cx->in_workq_name,sizeof (cx->in_workq_name),"%s-in" , cx->v4l2_dev.name); - cx->in_work_queue =alloc_ordered_workqueue (cx->in_workq_name,0 ); + cx->in_work_queue =alloc_ordered_workqueue ("%s" ,0 , cx->in_workq_name);if (cx->in_work_queue ==NULL ) {CX18_ERR ("Unable to create incoming mailbox handler thread\n" );return -ENOMEM ;
drivers/message/i2o/driver.c +2 -2
@@ -84,8 +84,8 @@ int i2o_driver_register(struct i2o_driver *drv)osm_debug ("Register driver %s\n" , drv->name);if (drv->event) { - drv->event_queue =alloc_workqueue (drv->name, -WQ_MEM_RECLAIM ,1 ); + drv->event_queue =alloc_workqueue ("%s" ,WQ_MEM_RECLAIM ,1 , + drv->name);if (!drv->event_queue) {osm_err ("Could not initialize event queue for driver " "%s\n" , drv->name);
drivers/net/wireless/rt2x00/rt2x00dev.c +1 -1
@@ -1321,7 +1321,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)* Initialize work. */ rt2x00dev->workqueue = -alloc_ordered_workqueue (wiphy_name (rt2x00dev->hw->wiphy),0 ); +alloc_ordered_workqueue ("%s" ,0 ,wiphy_name (rt2x00dev->hw->wiphy));if (!rt2x00dev->workqueue) { retval = -ENOMEM ; goto exit;
drivers/net/wireless/rtlwifi/base.c +1 -1
@@ -380,7 +380,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)/* <2> work queue */ rtlpriv->works.hw = hw; - rtlpriv->works.rtl_wq =alloc_workqueue (rtlpriv->cfg->name,0 ,0 ); + rtlpriv->works.rtl_wq =alloc_workqueue ("%s" ,0 ,0 , rtlpriv->cfg->name);INIT_DELAYED_WORK (&rtlpriv->works.watchdog_wq, (void *)rtl_watchdog_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
drivers/pci/hotplug/pciehp_hpc.c +1 -3
@@ -773,14 +773,12 @@ static void pcie_shutdown_notification(struct controller *ctrl)static int pcie_init_slot (struct controller *ctrl) {struct slot *slot; -char name[32 ]; slot =kzalloc (sizeof (*slot),GFP_KERNEL );if (!slot)return -ENOMEM ; -snprintf (name,sizeof (name),"pciehp-%u" ,PSN (ctrl)); - slot->wq =alloc_workqueue (name,0 ,0 ); + slot->wq =alloc_workqueue ("pciehp-%u" ,0 ,0 ,PSN (ctrl));if (!slot->wq) goto abort;
drivers/pci/hotplug/shpchp_core.c +1 -2
@@ -128,8 +128,7 @@ static int init_slots(struct controller *ctrl) slot->hpc_ops = ctrl->hpc_ops; slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); -snprintf (name,sizeof (name),"shpchp-%d" , slot->number); - slot->wq =alloc_workqueue (name,0 ,0 ); + slot->wq =alloc_workqueue ("shpchp-%d" ,0 ,0 , slot->number);if (!slot->wq) { retval = -ENOMEM ; goto error_info;
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -4996,7 +4996,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,snprintf (phba->wq_name,sizeof (phba->wq_name),"beiscsi_%02x_wq" , phba->shost->host_no); - phba->wq =alloc_workqueue (phba->wq_name,WQ_MEM_RECLAIM ,1 ); + phba->wq =alloc_workqueue ("%s" ,WQ_MEM_RECLAIM ,1 , phba->wq_name);if (!phba->wq) {beiscsi_log (phba,KERN_ERR ,BEISCSI_LOG_INIT , "BM_%d : beiscsi_dev_probe-"
drivers/scsi/qla4xxx/ql4_os.c +2 -2
@@ -7060,8 +7060,8 @@ skip_retry_init: }INIT_WORK (&ha->dpc_work, qla4xxx_do_dpc); -sprintf (buf,"qla4xxx_%lu_task" , ha->host_no); - ha->task_wq =alloc_workqueue (buf,WQ_MEM_RECLAIM ,1 ); + ha->task_wq =alloc_workqueue ("qla4xxx_%lu_task" ,WQ_MEM_RECLAIM ,1 , + ha->host_no);if (!ha->task_wq) {ql4_printk (KERN_WARNING , ha,"Unable to start task thread!\n" ); ret = -ENODEV ;
drivers/scsi/scsi_transport_fc.c +3 -3
@@ -435,7 +435,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,snprintf (fc_host->work_q_name,sizeof (fc_host->work_q_name),"fc_wq_%d" , shost->host_no); - fc_host->work_q =alloc_workqueue (fc_host->work_q_name,0 ,0 ); + fc_host->work_q =alloc_workqueue ("%s" ,0 ,0 , fc_host->work_q_name);if (!fc_host->work_q)return -ENOMEM ;
@@ -443,8 +443,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,snprintf (fc_host->devloss_work_q_name,sizeof (fc_host->devloss_work_q_name),"fc_dl_%d" , shost->host_no); - fc_host->devloss_work_q = -alloc_workqueue (fc_host->devloss_work_q_name,0 ,0 ); + fc_host->devloss_work_q =alloc_workqueue ("%s" ,0 ,0 , + fc_host->devloss_work_q_name);if (!fc_host->devloss_work_q) {destroy_workqueue (fc_host->work_q); fc_host->work_q =NULL ;
include/linux/workqueue.h +4 -3
@@ -410,11 +410,12 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) #define create_workqueue(name) \ - alloc_workqueue((name), WQ_MEM_RECLAIM, 1) + alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name)) #define create_freezable_workqueue(name) \ - alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) + alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ + 1, (name)) #define create_singlethread_workqueue(name) \ - alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) + alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) extern void destroy_workqueue(struct workqueue_struct *wq);
net/bluetooth/hci_core.c +4 -5
@@ -2202,16 +2202,15 @@ int hci_register_dev(struct hci_dev *hdev)list_add (&hdev->list, &hci_dev_list);write_unlock (&hci_dev_list_lock); - hdev->workqueue =alloc_workqueue (hdev->name,WQ_HIGHPRI |WQ_UNBOUND | -WQ_MEM_RECLAIM ,1 ); + hdev->workqueue =alloc_workqueue ("%s" ,WQ_HIGHPRI |WQ_UNBOUND | +WQ_MEM_RECLAIM ,1 , hdev->name);if (!hdev->workqueue) { error = -ENOMEM ; goto err; } - hdev->req_workqueue =alloc_workqueue (hdev->name, -WQ_HIGHPRI |WQ_UNBOUND | -WQ_MEM_RECLAIM ,1 ); + hdev->req_workqueue =alloc_workqueue ("%s" ,WQ_HIGHPRI |WQ_UNBOUND | +WQ_MEM_RECLAIM ,1 , hdev->name);if (!hdev->req_workqueue) {destroy_workqueue (hdev->workqueue); error = -ENOMEM ;
net/mac80211/main.c +1 -1
@@ -921,7 +921,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) hw->queues =IEEE80211_MAX_QUEUES ; local->workqueue = -alloc_ordered_workqueue (wiphy_name (local->hw.wiphy),0 ); +alloc_ordered_workqueue ("%s" ,0 ,wiphy_name (local->hw.wiphy));if (!local->workqueue) { result = -ENOMEM ; goto fail_workqueue;
Signature · 1 line
1.7.9.5
PATCH v2 5/6 kthread: avoid parsing names as format strings
In reply to Kees CookCalling kthread_run with a single name parameter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents.
--- drivers/block/aoe/aoecmd.c | 2 +- drivers/block/mtip32xx/mtip32xx.c | 3 ++- drivers/block/xen-blkback/xenbus.c | 2 +- drivers/hwmon/adt7470.c | 2 +- drivers/media/i2c/tvaudio.c | 3 ++- drivers/media/pci/ivtv/ivtv-driver.c | 2 +- drivers/media/platform/vivi.c | 3 ++- drivers/mtd/ubi/build.c | 2 +- drivers/net/wireless/airo.c | 3 ++- drivers/scsi/aacraid/commctrl.c | 3 ++- drivers/scsi/aacraid/commsup.c | 3 ++- drivers/spi/spi.c | 2 +- drivers/staging/rtl8712/os_intfs.c | 2 +- drivers/usb/atm/usbatm.c | 5 +++-- fs/lockd/svc.c | 2 +- fs/nfs/callback.c | 5 ++--- fs/nfs/nfs4state.c | 2 +- kernel/rcutree.c | 2 +- net/sunrpc/svc.c | 2 +- 19 files changed, 28 insertions(+), 22 deletions(-)
drivers/block/aoe/aoecmd.c +1 -1
@@ -1340,7 +1340,7 @@ aoe_ktstart(struct ktstate *k)struct task_struct *task;init_completion (&k->rendez); - task =kthread_run (kthread, k, k->name); + task =kthread_run (kthread, k,"%s" , k->name);if (task ==NULL ||IS_ERR (task))return -ENOMEM ; k->task = task;
drivers/block/mtip32xx/mtip32xx.c +2 -1
@@ -4085,7 +4085,8 @@ skip_create_disk: start_service_thread:sprintf (thd_name,"mtip_svc_thd_%02d" , index); dd->mtip_svc_handler =kthread_create_on_node (mtip_service_thread, - dd, dd->numa_node, thd_name); + dd, dd->numa_node,"%s" , + thd_name);if (IS_ERR (dd->mtip_svc_handler)) {dev_err (&dd->pdev->dev,"service thread failed to start\n" );
drivers/block/xen-blkback/xenbus.c +1 -1
@@ -93,7 +93,7 @@ static void xen_update_blkif_status(struct xen_blkif *blkif) }invalidate_inode_pages2 (blkif->vbd.bdev->bd_inode->i_mapping); - blkif->xenblkd =kthread_run (xen_blkif_schedule, blkif, name); + blkif->xenblkd =kthread_run (xen_blkif_schedule, blkif,"%s" , name);if (IS_ERR (blkif->xenblkd)) { err =PTR_ERR (blkif->xenblkd); blkif->xenblkd =NULL ;
drivers/hwmon/adt7470.c +1 -1
@@ -1285,7 +1285,7 @@ static int adt7470_probe(struct i2c_client *client, }init_completion (&data->auto_update_stop); - data->auto_update =kthread_run (adt7470_update_thread, client, + data->auto_update =kthread_run (adt7470_update_thread, client,"%s" ,dev_name (data->hwmon_dev));if (IS_ERR (data->auto_update)) { err =PTR_ERR (data->auto_update);
drivers/media/i2c/tvaudio.c +2 -1
@@ -2020,7 +2020,8 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id */* start async thread */ chip->wt.function = chip_thread_wake; chip->wt.data = (unsigned long )chip; - chip->thread =kthread_run (chip_thread, chip, client->name); + chip->thread =kthread_run (chip_thread, chip,"%s" , + client->name);if (IS_ERR (chip->thread)) {v4l2_warn (sd,"failed to create kthread\n" ); chip->thread =NULL ;
drivers/media/pci/ivtv/ivtv-driver.c +1 -1
@@ -753,7 +753,7 @@ static int ivtv_init_struct1(struct ivtv *itv)init_kthread_worker (&itv->irq_worker); itv->irq_worker_task =kthread_run (kthread_worker_fn, &itv->irq_worker, - itv->v4l2_dev.name); +"%s" , itv->v4l2_dev.name);if (IS_ERR (itv->irq_worker_task)) {IVTV_ERR ("Could not create ivtv task\n" );return -1 ;
drivers/media/platform/vivi.c +2 -1
@@ -768,7 +768,8 @@ static int vivi_start_generating(struct vivi_dev *dev) dma_q->frame =0 ; dma_q->ini_jiffies = jiffies; - dma_q->kthread =kthread_run (vivi_thread, dev, dev->v4l2_dev.name); + dma_q->kthread =kthread_run (vivi_thread, dev,"%s" , + dev->v4l2_dev.name);if (IS_ERR (dma_q->kthread)) {v4l2_err (&dev->v4l2_dev,"kernel_thread() failed\n" );
drivers/mtd/ubi/build.c +1 -1
@@ -1005,7 +1005,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,if (err) goto out_uif; - ubi->bgt_thread =kthread_create (ubi_thread, ubi, ubi->bgt_name); + ubi->bgt_thread =kthread_create (ubi_thread, ubi,"%s" , ubi->bgt_name);if (IS_ERR (ubi->bgt_thread)) { err =PTR_ERR (ubi->bgt_thread); ubi_err("cannot spawn \"%s\", error %d", ubi->bgt_name,
drivers/net/wireless/airo.c +2 -1
@@ -1893,7 +1893,8 @@ static int airo_open(struct net_device *dev) {if (ai->wifidev != dev) {clear_bit (JOB_DIE , &ai->jobs); - ai->airo_thread_task =kthread_run (airo_thread, dev, dev->name); + ai->airo_thread_task =kthread_run (airo_thread, dev,"%s" , + dev->name);if (IS_ERR (ai->airo_thread_task))return (int )PTR_ERR (ai->airo_thread_task);
drivers/scsi/aacraid/commctrl.c +2 -1
@@ -318,7 +318,8 @@ return_fib:kthread_stop (dev->thread);ssleep (1 ); dev->aif_thread =0 ; - dev->thread =kthread_run (aac_command_thread, dev, dev->name); + dev->thread =kthread_run (aac_command_thread, dev, +"%s" , dev->name);ssleep (1 ); }if (f.wait) {
drivers/scsi/aacraid/commsup.c +2 -1
@@ -1336,7 +1336,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)if ((retval =pci_set_dma_mask (aac->pdev,DMA_BIT_MASK (32 )))) goto out;if (jafo) { - aac->thread =kthread_run (aac_command_thread, aac, aac->name); + aac->thread =kthread_run (aac_command_thread, aac,"%s" , + aac->name);if (IS_ERR (aac->thread)) { retval =PTR_ERR (aac->thread); goto out;
drivers/spi/spi.c +1 -1
@@ -601,7 +601,7 @@ static int spi_init_queue(struct spi_master *master)init_kthread_worker (&master->kworker); master->kworker_task =kthread_run (kthread_worker_fn, - &master->kworker, + &master->kworker,"%s" ,dev_name (&master->dev));if (IS_ERR (master->kworker_task)) {dev_err (&master->dev,"failed to create message pump task\n" );
drivers/staging/rtl8712/os_intfs.c +1 -1
@@ -238,7 +238,7 @@ struct net_device *r8712_init_netdev(void)static u32 start_drv_threads (struct _adapter *padapter) { - padapter->cmdThread =kthread_run (r8712_cmd_thread, padapter, + padapter->cmdThread =kthread_run (r8712_cmd_thread, padapter,"%s" , padapter->pnetdev->name);if (IS_ERR (padapter->cmdThread) <0 )return _FAIL;
drivers/usb/atm/usbatm.c +3 -2
@@ -1020,7 +1020,7 @@ static int usbatm_heavy_init(struct usbatm_data *instance) {struct task_struct *t; - t =kthread_create (usbatm_do_heavy_init, instance, + t =kthread_create (usbatm_do_heavy_init, instance,"%s" , instance->driver->driver_name);if (IS_ERR (t)) { usb_err(instance, "%s: failed to create kernel_thread (%ld)!\n",
@@ -1076,7 +1076,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,/* public fields */ instance->driver = driver; -snprintf (instance->driver_name,sizeof (instance->driver_name), driver->driver_name); +strlcpy (instance->driver_name, driver->driver_name, +sizeof (instance->driver_name)); instance->usb_dev = usb_dev; instance->usb_intf = intf;
fs/lockd/svc.c +1 -1
@@ -305,7 +305,7 @@ static int lockd_start_svc(struct svc_serv *serv)svc_sock_update_bufs (serv); serv->sv_maxconn = nlm_max_connections; - nlmsvc_task =kthread_run (lockd, nlmsvc_rqst, serv->sv_name); + nlmsvc_task =kthread_run (lockd, nlmsvc_rqst,"%s" , serv->sv_name);if (IS_ERR (nlmsvc_task)) { error =PTR_ERR (nlmsvc_task); printk(KERN_WARNING
fs/nfs/callback.c +2 -3
@@ -211,7 +211,6 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,struct svc_rqst *rqstp;int (*callback_svc)(void *vrqstp);struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; -char svc_name[12 ];int ret;nfs_callback_bc_serv (minorversion, xprt, serv);
@@ -235,10 +234,10 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,svc_sock_update_bufs (serv); -sprintf (svc_name,"nfsv4.%u-svc" , minorversion); cb_info->serv = serv; cb_info->rqst = rqstp; - cb_info->task =kthread_run (callback_svc, cb_info->rqst, svc_name); + cb_info->task =kthread_run (callback_svc, cb_info->rqst, +"nfsv4.%u-svc" , minorversion);if (IS_ERR (cb_info->task)) { ret =PTR_ERR (cb_info->task);svc_exit_thread (cb_info->rqst);
fs/nfs/nfs4state.c +1 -1
@@ -1194,7 +1194,7 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)snprintf (buf,sizeof (buf),"%s-manager" ,rpc_peeraddr2str (clp->cl_rpcclient,RPC_DISPLAY_ADDR ));rcu_read_unlock (); - task =kthread_run (nfs4_run_state_manager, clp, buf); + task =kthread_run (nfs4_run_state_manager, clp,"%s" , buf);if (IS_ERR (task)) {printk (KERN_ERR "%s: kthread_run: %ld\n" , __func__,PTR_ERR (task));
kernel/rcutree.c +1 -1
@@ -3108,7 +3108,7 @@ static int __init rcu_spawn_gp_kthread(void)struct task_struct *t;for_each_rcu_flavor (rsp) { - t =kthread_run (rcu_gp_kthread, rsp, rsp->name); + t =kthread_run (rcu_gp_kthread, rsp,"%s" , rsp->name);BUG_ON (IS_ERR (t)); rnp =rcu_get_root (rsp);raw_spin_lock_irqsave (&rnp->lock, flags);
net/sunrpc/svc.c +1 -1
@@ -740,7 +740,7 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)__module_get (serv->sv_module); task =kthread_create_on_node (serv->sv_function, rqstp, - node, serv->sv_name); + node,"%s" , serv->sv_name);if (IS_ERR (task)) { error =PTR_ERR (task);module_put (serv->sv_module);
Signature · 1 line
1.7.9.5
Re: [PATCH 5/6] kthread: avoid parsing names as format strings
Hi Kees,
Quoted 8 lines · Kees Cook
Calling
kthread_runwith a single name parameter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents.Signed-off-by Kees Cook <[email protected]>--- drivers/block/aoe/aoecmd.c | 2 +- drivers/block/mtip32xx/mtip32xx.c | 3 ++-
[...]
drivers/block/mtip32xx/mtip32xx.c skip_create_disk: · line 4086
Quoted 7 lines
drivers/block/mtip32xx/mtip32xx.c +0
-0@@ -4085,7 +4085,8 @@ skip_create_disk: start_service_thread:sprintf (thd_name,"mtip_svc_thd_%02d" , index);
We can also save some bytes here, remove the sprintf() and thd_name[]
drivers/block/mtip32xx/mtip32xx.c skip_create_disk: · line 4092
Quoted 7 lines
drivers/block/mtip32xx/mtip32xx.c +2
-1dd->mtip_svc_handler =kthread_create_on_node (mtip_service_thread, - dd, dd->numa_node, thd_name); + dd, dd->numa_node,"%s" , + thd_name);if (IS_ERR (dd->mtip_svc_handler)) {dev_err (&dd->pdev->dev,"service thread failed to start\n" );
Thanks!
Signature · 2 lines
Djalal Harouni http://opendz.org
PATCH v2 6/6 isdn: clean up debug format string usage
In reply to Kees CookAvoid unneeded local string buffers for constructing debug output. Also cleans up debug calls that contain a single parameter so that they cannot be accidentally parsed as format strings.
--- drivers/isdn/hisax/amd7930_fn.c | 4 ++-- drivers/isdn/hisax/avm_pci.c | 4 ++-- drivers/isdn/hisax/config.c | 2 +- drivers/isdn/hisax/diva.c | 4 ++-- drivers/isdn/hisax/elsa.c | 2 +- drivers/isdn/hisax/elsa_ser.c | 2 +- drivers/isdn/hisax/hfc_pci.c | 2 +- drivers/isdn/hisax/hfc_sx.c | 2 +- drivers/isdn/hisax/hscx_irq.c | 4 ++-- drivers/isdn/hisax/icc.c | 4 ++-- drivers/isdn/hisax/ipacx.c | 8 +++---- drivers/isdn/hisax/isac.c | 4 ++-- drivers/isdn/hisax/isar.c | 6 ++--- drivers/isdn/hisax/jade.c | 18 ++++---------- drivers/isdn/hisax/jade_irq.c | 4 ++-- drivers/isdn/hisax/l3_1tr6.c | 50 ++++++++++++++------------------------- drivers/isdn/hisax/netjet.c | 2 +- drivers/isdn/hisax/q931.c | 6 ++--- drivers/isdn/hisax/w6692.c | 8 +++---- 19 files changed, 57 insertions(+), 79 deletions(-)
drivers/isdn/hisax/amd7930_fn.c +2 -2
@@ -314,7 +314,7 @@ Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag) t +=sprintf (t,"Amd7930: empty_Dfifo cnt: %d |" , cs->rcvidx);QuickHex (t, cs->rcvbuf, cs->rcvidx); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); }/* moves received data in sk-buffer */ memcpy (skb_put (skb, cs->rcvidx), cs->rcvbuf, cs->rcvidx);
@@ -406,7 +406,7 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs) t +=sprintf (t,"Amd7930: fill_Dfifo cnt: %d |" , count);QuickHex (t, deb_ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); }/* AMD interrupts on */ AmdIrqOn (cs);
drivers/isdn/hisax/avm_pci.c +2 -2
@@ -285,7 +285,7 @@ hdlc_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"hdlc_empty_fifo %c cnt %d" , bcs->channel ?'B' :'A' , count);QuickHex (t, p, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -345,7 +345,7 @@ hdlc_fill_fifo(struct BCState *bcs) t +=sprintf (t,"hdlc_fill_fifo %c cnt %d" , bcs->channel ?'B' :'A' , count);QuickHex (t, p, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
drivers/isdn/hisax/config.c +1 -1
@@ -1896,7 +1896,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if) ptr--; *ptr++ ='\n' ; *ptr =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog); }else HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)",
drivers/isdn/hisax/diva.c +2 -2
@@ -427,7 +427,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"hscx_empty_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -469,7 +469,7 @@ Memhscx_fill_fifo(struct BCState *bcs) t +=sprintf (t,"hscx_fill_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
drivers/isdn/hisax/elsa.c +1 -1
@@ -535,7 +535,7 @@ check_arcofi(struct IsdnCardState *cs) t = tmp; t +=sprintf (tmp,"Arcofi data" );QuickHex (t, p, cs->dc.isac.mon_rxp); -debugl1 (cs, tmp); +debugl1 (cs,"%s" , tmp);if ((cs->dc.isac.mon_rxp ==2 ) && (cs->dc.isac.mon_rx[0 ] ==0xa0 )) {switch (cs->dc.isac.mon_rx[1 ]) {case 0x80 :
drivers/isdn/hisax/elsa_ser.c +1 -1
@@ -344,7 +344,7 @@ static inline void receive_chars(struct IsdnCardState *cs, t +=sprintf (t,"modem read cnt %d" , cs->hw.elsa.rcvcnt);QuickHex (t, cs->hw.elsa.rcvbuf, cs->hw.elsa.rcvcnt); -debugl1 (cs, tmp); +debugl1 (cs,"%s" , tmp); } cs->hw.elsa.rcvcnt =0 ; }
drivers/isdn/hisax/hfc_pci.c +1 -1
@@ -901,7 +901,7 @@ Begin: ptr--; *ptr++ ='\n' ; *ptr =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog); }else HiSax_putstatus (cs,"LogEcho: " ,"warning Frame too big (%d)" , total -3 ); }
drivers/isdn/hisax/hfc_sx.c +1 -1
@@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs) ptr--; *ptr++ ='\n' ; *ptr =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog); }else HiSax_putstatus (cs,"LogEcho: " ,"warning Frame too big (%d)" , skb->len); }
drivers/isdn/hisax/hscx_irq.c +2 -2
@@ -75,7 +75,7 @@ hscx_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"hscx_empty_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -115,7 +115,7 @@ hscx_fill_fifo(struct BCState *bcs) t +=sprintf (t,"hscx_fill_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
drivers/isdn/hisax/icc.c +2 -2
@@ -134,7 +134,7 @@ icc_empty_fifo(struct IsdnCardState *cs, int count) t +=sprintf (t,"icc_empty_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -176,7 +176,7 @@ icc_fill_fifo(struct IsdnCardState *cs) t +=sprintf (t,"icc_fill_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
drivers/isdn/hisax/ipacx.c +4 -4
@@ -260,7 +260,7 @@ dch_empty_fifo(struct IsdnCardState *cs, int count) t +=sprintf (t,"dch_empty_fifo() cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -307,7 +307,7 @@ dch_fill_fifo(struct IsdnCardState *cs) t +=sprintf (t,"dch_fill_fifo() cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -539,7 +539,7 @@ bch_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"bch_empty_fifo() B-%d cnt %d" , hscx, count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -582,7 +582,7 @@ bch_fill_fifo(struct BCState *bcs) t +=sprintf (t,"chb_fill_fifo() B-%d cnt %d" , hscx, count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
drivers/isdn/hisax/isac.c +2 -2
@@ -137,7 +137,7 @@ isac_empty_fifo(struct IsdnCardState *cs, int count) t +=sprintf (t,"isac_empty_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -179,7 +179,7 @@ isac_fill_fifo(struct IsdnCardState *cs) t +=sprintf (t,"isac_fill_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
drivers/isdn/hisax/isar.c +3 -3
@@ -74,7 +74,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len, t = tmp; t +=sprintf (t,"sendmbox cnt %d" , len);QuickHex (t, &msg[len-i], (i >64 ) ?64 : i); -debugl1 (cs, tmp); +debugl1 (cs,"%s" , tmp); i -=64 ; } }
@@ -105,7 +105,7 @@ rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg) t = tmp; t +=sprintf (t,"rcv_mbox cnt %d" , ireg->clsb);QuickHex (t, &msg[ireg->clsb - i], (i >64 ) ?64 : i); -debugl1 (cs, tmp); +debugl1 (cs,"%s" , tmp); i -=64 ; } }
@@ -1248,7 +1248,7 @@ isar_int_main(struct IsdnCardState *cs) tp +=sprintf (debbuf,"msg iis(%x) msb(%x)" , ireg->iis, ireg->cmsb);QuickHex (tp, (u_char *)ireg->par, ireg->clsb); -debugl1 (cs, debbuf); +debugl1 (cs,"%s" , debbuf); }break ;case ISAR_IIS_INVMSG :
drivers/isdn/hisax/jade.c +5 -13
@@ -81,10 +81,7 @@ modejade(struct BCState *bcs, int mode, int bc)int jade = bcs->hw.hscx.hscx;if (cs->debug &L1_DEB_HSCX ) { -char tmp[40 ]; -sprintf (tmp,"jade %c mode %d ichan %d" , -'A' + jade, mode, bc); -debugl1 (cs, tmp); +debugl1 (cs,"jade %c mode %d ichan %d" ,'A' + jade, mode, bc); } bcs->mode = mode; bcs->channel = bc;
@@ -257,23 +254,18 @@ void clear_pending_jade_ints(struct IsdnCardState *cs) {int val; -char tmp[64 ]; cs->BC_Write_Reg (cs,0 , jade_HDLC_IMR,0x00 ); cs->BC_Write_Reg (cs,1 , jade_HDLC_IMR,0x00 ); val = cs->BC_Read_Reg (cs,1 , jade_HDLC_ISR); -sprintf (tmp,"jade B ISTA %x" , val); -debugl1 (cs, tmp); +debugl1 (cs,"jade B ISTA %x" , val); val = cs->BC_Read_Reg (cs,0 , jade_HDLC_ISR); -sprintf (tmp,"jade A ISTA %x" , val); -debugl1 (cs, tmp); +debugl1 (cs,"jade A ISTA %x" , val); val = cs->BC_Read_Reg (cs,1 , jade_HDLC_STAR); -sprintf (tmp,"jade B STAR %x" , val); -debugl1 (cs, tmp); +debugl1 (cs,"jade B STAR %x" , val); val = cs->BC_Read_Reg (cs,0 , jade_HDLC_STAR); -sprintf (tmp,"jade A STAR %x" , val); -debugl1 (cs, tmp); +debugl1 (cs,"jade A STAR %x" , val);/* Unmask ints */ cs->BC_Write_Reg (cs,0 , jade_HDLC_IMR,0xF8 ); cs->BC_Write_Reg (cs,1 , jade_HDLC_IMR,0xF8 );
drivers/isdn/hisax/jade_irq.c +2 -2
@@ -65,7 +65,7 @@ jade_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"jade_empty_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -105,7 +105,7 @@ jade_fill_fifo(struct BCState *bcs) t +=sprintf (t,"jade_fill_fifo %c cnt %d" , bcs->hw.hscx.hscx ?'B' :'A' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
drivers/isdn/hisax/l3_1tr6.c +18 -32
170 lines not on this page · raw message
drivers/isdn/hisax/netjet.c +1 -1
@@ -176,7 +176,7 @@ static void printframe(struct IsdnCardState *cs, u_char *buf, int count, char *selse j = i;QuickHex (t, p, j); -debugl1 (cs, tmp); +debugl1 (cs,"%s" , tmp); p += j; i -= j; t = tmp;
drivers/isdn/hisax/q931.c +3 -3
@@ -1179,7 +1179,7 @@ LogFrame(struct IsdnCardState *cs, u_char *buf, int size) dp--; *dp++ ='\n' ; *dp =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog); }else HiSax_putstatus (cs,"LogFrame: " ,"warning Frame too big (%d)" , size); }
@@ -1246,7 +1246,7 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) }if (finish) { *dp =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog);return ; }if ((0xfe & buf[0 ]) ==PROTO_DIS_N0 ) {/* 1TR6 */
@@ -1509,5 +1509,5 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) dp +=sprintf (dp,"Unknown protocol %x!" , buf[0 ]); } *dp =0 ; -HiSax_putstatus (cs,NULL , cs->dlog); +HiSax_putstatus (cs,NULL ,"%s" , cs->dlog); }
drivers/isdn/hisax/w6692.c +4 -4
@@ -154,7 +154,7 @@ W6692_empty_fifo(struct IsdnCardState *cs, int count) t +=sprintf (t,"W6692_empty_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -196,7 +196,7 @@ W6692_fill_fifo(struct IsdnCardState *cs) t +=sprintf (t,"W6692_fill_fifo cnt %d" , count);QuickHex (t, ptr, count); -debugl1 (cs, cs->dlog); +debugl1 (cs,"%s" , cs->dlog); } }
@@ -226,7 +226,7 @@ W6692B_empty_fifo(struct BCState *bcs, int count) t +=sprintf (t,"W6692B_empty_fifo %c cnt %d" , bcs->channel +'1' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
@@ -264,7 +264,7 @@ W6692B_fill_fifo(struct BCState *bcs) t +=sprintf (t,"W6692B_fill_fifo %c cnt %d" , bcs->channel +'1' , count);QuickHex (t, ptr, count); -debugl1 (cs, bcs->blog); +debugl1 (cs,"%s" , bcs->blog); } }
Signature · 1 line
1.7.9.5