├── 9p ├── category2a_p9_client_walk.cocci ├── category2a_p9_client_walk.desc ├── p9_client_walk.cocci └── p9_client_walk.desc ├── CONTRIB ├── README └── firehose │ ├── README │ ├── arref │ ├── arref.c │ ├── arref.cocci │ └── arref.desc │ ├── badand │ ├── badand.c │ ├── badand.cocci │ └── badand.desc │ ├── badkm2 │ ├── badkm2.c │ ├── badkm2.cocci │ └── badkm2.desc │ ├── bitcall │ ├── bitcall.c │ ├── bitcall.cocci │ └── bitcall.desc │ ├── da │ ├── da.c │ ├── da.cocci │ └── da.desc │ ├── double_null │ ├── double_null.c │ ├── double_null.cocci │ └── double_null.desc │ ├── doubleinit │ ├── doubleinit.c │ ├── doubleinit.cocci │ └── doubleinit.desc │ ├── doubletest │ ├── doubletest.c │ ├── doubletest.cocci │ └── doubletest.desc │ ├── drop_continue │ ├── drop_continue.c │ ├── drop_continue.cocci │ └── drop_continue.desc │ ├── if-semicolon │ ├── if-semicolon.c │ ├── if-semicolon.cocci │ └── if-semicolon.desc │ ├── ifaddr │ ├── ifaddr.c │ ├── ifaddr.cocci │ └── ifaddr.desc │ ├── noderef │ ├── noderef.cocci │ └── noderef.desc │ └── ret │ ├── ret.c │ ├── ret.cocci │ └── ret.desc ├── LICENSE ├── README ├── aaci ├── category2a_aaci_init_card.cocci └── category2a_aaci_init_card.desc ├── acl ├── patch.cocci └── patch.desc ├── acpi ├── category2b_back_device_reg.cocci └── category2b_back_device_reg.desc ├── acpid ├── acpi.cocci └── acpi.desc ├── after_netif ├── after_netif.cocci ├── after_netif.desc ├── after_netif_modif.cocci └── after_netif_modif.desc ├── ainerr ├── ainerr.cocci └── ainerr.desc ├── alloc9 ├── kmalloc9.cocci └── kmalloc9.desc ├── alloc_cast ├── alloc_cast.cocci └── alloc_cast.desc ├── alloc_domain ├── easykmret.cocci └── easykmret.desc ├── alloc_etherdev ├── alloc.cocci └── alloc.desc ├── alloc_tty ├── alloc_tty.cocci └── alloc_tty.desc ├── allocs ├── a2.cocci └── a2.desc ├── array_and_size ├── array_and_size_clean.cocci └── array_and_size_clean.desc ├── arraysize ├── array.cocci └── array.desc ├── arraytest ├── arraytest.cocci └── arraytest.desc ├── arref ├── arref.cocci └── arref.desc ├── asprintf ├── asprintf.cocci └── asprintf.desc ├── atm ├── atm.cocci └── atm.desc ├── auth ├── auth.cocci └── auth.desc ├── badand ├── badand.cocci └── badand.desc ├── badcheck ├── badcheck.cocci └── badcheck.desc ├── badftest ├── badftest.cocci └── badftest.desc ├── badkm ├── badkm.cocci └── badkm.desc ├── badkm2 ├── badkm2.cocci └── badkm2.desc ├── badktest ├── badktest.cocci └── badktest.desc ├── badmsg ├── badmsg.cocci └── badmsg.desc ├── badmsg3 ├── badmsg3.cocci └── badmsg3.desc ├── badpt ├── badpt.cocci └── badpt.desc ├── badty ├── badty.cocci └── badty.desc ├── bitcall ├── bitcall.cocci └── bitcall.desc ├── bits ├── notand.cocci └── notand.desc ├── bits2 ├── notand.cocci └── notand.desc ├── block_nil ├── retsall.cocci └── retsall.desc ├── bo ├── bo.cocci └── bo.desc ├── bond ├── short_timeout.cocci └── short_timeout.desc ├── bootmem ├── bootmem.cocci └── bootmem.desc ├── bootmem2 ├── bootmem.cocci └── bootmem.desc ├── bss ├── sp1094.cocci └── sp1094.desc ├── btrfs ├── btrfs.cocci └── btrfs.desc ├── bugon ├── newbugon.cocci └── newbugon.desc ├── c99 ├── c99.cocci └── c99.desc ├── cache ├── cache.cocci └── cache.desc ├── call_kern1 ├── call_kern1.cocci └── call_kern1.desc ├── call_kern3 ├── call_kern3.cocci └── call_kern3.desc ├── capi ├── capi.cocci └── capi.desc ├── castnet ├── castnet.cocci └── castnet.desc ├── checkdoc ├── checkdoc.cocci └── checkdoc.desc ├── clkderef ├── clkderef.cocci └── clkderef.desc ├── clkput ├── clkput.cocci └── clkput.desc ├── comma ├── comma.cocci └── comma.desc ├── compare ├── compare.cocci └── compare.desc ├── const_component_ops ├── const_component_ops.cocci └── const_component_ops.desc ├── const_dvb_tuner_ops ├── const_dvb_tuner_ops.cocci └── const_dvb_tuner_ops.desc ├── const_ethtool ├── const_ethtool.cocci └── const_ethtool.desc ├── const_fb_fix_screeninfo ├── const_fb_fix_screeninfo.cocci ├── const_fb_fix_screeninfo.desc ├── const_fb_var_screeninfo.cocci └── const_fb_var_screeninfo.desc ├── const_gpio_chip ├── const_gpio_chip.cocci └── const_gpio_chip.desc ├── const_i2c_adapter_quirks ├── const_i2c_adapter_quirks.cocci └── const_i2c_adapter_quirks.desc ├── const_i2c_algo ├── const_i2c_alg.cocci └── const_i2c_alg.desc ├── const_iio_info ├── const_iio_info.cocci └── const_iio_info.desc ├── const_l3mdev_ops ├── const_l3mdev_ops.cocci └── const_l3mdev_ops.desc ├── const_net_device_ops ├── const_net_device_ops.cocci └── const_net_device_ops.desc ├── const_pinctrl ├── const_pinctrl.cocci └── const_pinctrl.desc ├── const_rtc_class_ops ├── const_rtc_class_ops.cocci └── const_rtc_class_ops.desc ├── const_snd_pcm_ops ├── const_snd_pcm_ops.cocci └── const_snd_pcm_ops.desc ├── const_snd_soc_codec_driver ├── const_snd_soc_codec_driver.cocci └── const_snd_soc_codec_driver.desc ├── const_snd_soc_ops ├── const_snd_soc_ops.cocci └── const_snd_soc_ops.desc ├── const_uart ├── const_uart_ops.cocci └── const_uart_ops.desc ├── const_watchdog_ops ├── const_watchdog_ops.cocci └── const_watchdog_ops.desc ├── consts ├── consts.cocci └── consts.desc ├── countptr ├── countptr.cocci └── countptr.desc ├── cpu ├── cpu.cocci └── cpu.desc ├── cpu_mask ├── cpu_mask.cocci └── cpu_mask.desc ├── cpufreq ├── patch.cocci └── patch.desc ├── cris ├── mutex2.cocci └── mutex2.desc ├── crypto ├── crypto.cocci └── crypto.desc ├── cspage ├── cspage.cocci └── cspage.desc ├── cstptr ├── cstptr.cocci └── cstptr.desc ├── ctu ├── ctu.cocci └── ctu.desc ├── da ├── da.cocci └── da.desc ├── da2 ├── da2.cocci └── da2.desc ├── dall ├── dall.cocci └── dall.desc ├── dangling ├── dangling.cocci └── dangling.desc ├── dca ├── constify.cocci ├── constify.desc ├── onlyfunctions.cocci └── onlyfunctions.desc ├── delt ├── delt.cocci └── delt.desc ├── deltr ├── deltr.cocci └── deltr.desc ├── depspin ├── sl.cocci └── sl.desc ├── derefnull ├── isnull.cocci └── isnull.desc ├── destroy ├── destroy.cocci └── destroy.desc ├── device_attrs ├── device_attrs.cocci └── device_attrs.desc ├── device_attrs2 ├── device_attrs2.cocci └── device_attrs2.desc ├── devm2 ├── devm2i.cocci └── devm2i.desc ├── devm2a ├── devm2i.cocci └── devm2i.desc ├── devm2b ├── devm2i.cocci └── devm2i.desc ├── devm2i_0729 ├── devm2i.cocci ├── devm2i.desc ├── request_and_ioremap.cocci └── request_and_ioremap.desc ├── devm2i_0730 ├── devm2i.cocci ├── devm2i.desc ├── request_and_ioremap.cocci └── request_and_ioremap.desc ├── devm2i_0731 ├── devm2i.cocci ├── devm2i.desc ├── request_and_ioremap.cocci └── request_and_ioremap.desc ├── devm2i_aug25 ├── devm2i.cocci ├── devm2i.desc ├── request_and_ioremap.cocci └── request_and_ioremap.desc ├── devm4 ├── devm4.cocci └── devm4.desc ├── devm6 ├── devm6.cocci └── devm6.desc ├── devmir ├── devmir.cocci └── devmir.desc ├── devname ├── devname.cocci └── devname.desc ├── diou ├── diou.cocci └── diou.desc ├── diou2 ├── diou.cocci └── diou.desc ├── diou3 ├── devm3.cocci └── devm3.desc ├── dma ├── set_dma_mode_1.cocci └── set_dma_mode_1.desc ├── dmaz ├── dmaz.cocci └── dmaz.desc ├── double_call ├── dc.cocci └── dc.desc ├── double_error_check ├── double_error_check.cocci └── double_error_check.desc ├── double_lock ├── double_lock.cocci └── double_lock.desc ├── double_null ├── double_null.cocci └── double_null.desc ├── double_test ├── double_test.cocci └── double_test.desc ├── doublefree ├── frees.cocci └── frees.desc ├── doubleinit ├── doubleinit.cocci └── doubleinit.desc ├── doublermr ├── doublermr.cocci └── doublermr.desc ├── doubleskb ├── doubleskb.cocci └── doubleskb.desc ├── doubletest ├── doubletest.cocci └── doubletest.desc ├── doubletest_high ├── doubletest_highconfidence.cocci └── doubletest_highconfidence.desc ├── drop_continue ├── cont.cocci └── cont.desc ├── drvdata ├── drvdata.cocci └── drvdata.desc ├── dst ├── dst.cocci └── dst.desc ├── enter ├── enter.cocci └── enter.desc ├── epd ├── epd.cocci ├── epd.desc ├── mini.cocci └── mini.desc ├── epdneg ├── epdneg.cocci └── epdneg.desc ├── errcast ├── errcast.cocci └── errcast.desc ├── eth64 ├── eth.cocci └── eth.desc ├── even_more_pci ├── get_slot.cocci └── get_slot.desc ├── exact ├── exact.cocci └── exact.desc ├── export5 ├── export5.cocci └── export5.desc ├── export_static ├── export4.cocci └── export4.desc ├── extra_put ├── extra_put.cocci └── extra_put.desc ├── fbrelease ├── metapatch.cocci ├── metapatch.desc ├── patch.cocci └── patch.desc ├── fen ├── fen.cocci └── fen.desc ├── ffz ├── ffz.cocci └── ffz.desc ├── fields ├── field.cocci └── field.desc ├── for_each_child1 ├── for_each_child1.cocci ├── for_each_child1.desc ├── for_each_child1_ext.cocci └── for_each_child1_ext.desc ├── for_each_child2 ├── for_each_child2.cocci └── for_each_child2.desc ├── for_each_child5 ├── for_each_child5.cocci └── for_each_child5.desc ├── free_irq ├── free_irq.cocci └── free_irq.desc ├── freenull ├── freenull.cocci └── freenull.desc ├── frfr ├── frfr.cocci └── frfr.desc ├── ftl ├── ftl.cocci └── ftl.desc ├── func ├── func.cocci └── func.desc ├── fuse ├── fuse.cocci └── fuse.desc ├── gdth ├── gdth.cocci └── gdth.desc ├── getprop ├── getprop.cocci └── getprop.desc ├── getprop2 ├── getprop2.cocci └── getprop2.desc ├── gfs2 ├── category2a_gfs2_inode_lookup.cocci └── category2a_gfs2_inode_lookup.desc ├── gmc ├── gmc.cocci └── gmc.desc ├── handle ├── handle.cocci └── handle.desc ├── hrtimer ├── hrtimer.cocci └── hrtimer.desc ├── i2c_msg ├── i2c_msg.cocci └── i2c_msg.desc ├── i915 ├── sp1517.cocci └── sp1517.desc ├── ie2 ├── ie2.cocci └── ie2.desc ├── if-semicolon ├── if-semicolon.cocci └── if-semicolon.desc ├── ifcol ├── ifcol.cocci └── ifcol.desc ├── iff ├── iff.cocci └── iff.desc ├── ifseqerr ├── ifseqerr.cocci └── ifseqerr.desc ├── incon ├── incon3.cocci └── incon3.desc ├── infiniband ├── category2a_ib_create_send_mad.cocci ├── category2a_ib_create_send_mad.desc ├── category2a_ucma_alloc_multicast.cocci └── category2a_ucma_alloc_multicast.desc ├── init ├── useful_inits3.cocci └── useful_inits3.desc ├── input ├── sp2486.cocci ├── sp2486.desc ├── sp2495.cocci ├── sp2495.desc ├── sp2506.cocci └── sp2506.desc ├── iom ├── devm2i.cocci ├── devm2i.desc ├── iom.cocci └── iom.desc ├── ioremap2 ├── simplify_ioremap_resource2.cocci └── simplify_ioremap_resource2.desc ├── iounmap ├── ioremap_check.cocci └── ioremap_check.desc ├── is_static ├── is_static.cocci └── is_static.desc ├── iserr ├── patch1.cocci ├── patch1.desc ├── patch2.cocci ├── patch2.desc ├── patch3.cocci ├── patch3.desc ├── patch45.cocci ├── patch45.desc ├── send_ct.cocci └── send_ct.desc ├── iserr_cata ├── category2a.cocci └── category2a.desc ├── iserr_ref ├── iserr_mini.cocci ├── iserr_mini.desc ├── iserr_ref.cocci └── iserr_ref.desc ├── iserreq ├── ise2.cocci └── ise2.desc ├── isnull_oct ├── isnull.cocci └── isnull.desc ├── isnullo ├── isnull.cocci └── isnull.desc ├── itnull ├── itnull.cocci └── itnull.desc ├── iwcontainer ├── extra_null.cocci └── extra_null.desc ├── jiffies ├── jiffies.cocci └── jiffies.desc ├── k-zc-alloc ├── kzalloc.cocci └── kzalloc.desc ├── kasp ├── kasp.cocci └── kasp.desc ├── kasprintf2 ├── aspmem.cocci └── aspmem.desc ├── kc ├── kc.cocci └── kc.desc ├── kfree3 ├── kmalloc.cocci ├── kmalloc.desc ├── kmalloc8a.cocci └── kmalloc8a.desc ├── kfree_after ├── kfree_after.cocci └── kfree_after.desc ├── kfree_after2 ├── kfree_after.cocci └── kfree_after.desc ├── kfree_skb ├── skbfree.cocci └── skbfree.desc ├── kfrees ├── kfree.cocci └── kfree.desc ├── kmalloc9 ├── kmalloc9.cocci └── kmalloc9.desc ├── kmc1 ├── kmc1.cocci └── kmc1.desc ├── kmc1a ├── kmc1.cocci └── kmc1.desc ├── kmerr1 ├── kmerr1.cocci └── kmerr1.desc ├── kmerr2 ├── kmerr2.cocci └── kmerr2.desc ├── kmerr3 ├── kmerr3.cocci └── kmerr3.desc ├── kmtest ├── kmtest.cocci └── kmtest.desc ├── knav ├── knav.cocci └── knav.desc ├── kstr ├── kstr.cocci └── kstr.desc ├── kstrdup ├── kstrdup.cocci └── kstrdup.desc ├── kzif ├── kzif.cocci └── kzif.desc ├── label1 ├── label1.cocci └── label1.desc ├── label2 ├── label2.cocci └── label2.desc ├── lcd ├── category2b_back_device_reg.cocci └── category2b_back_device_reg.desc ├── lenull ├── lenull.cocci └── lenull.desc ├── leq ├── leq.cocci └── leq.desc ├── lfee ├── lfee.cocci └── lfee.desc ├── list_entry ├── rcu2.cocci └── rcu2.desc ├── list_entry_update ├── list_entry_update.cocci └── list_entry_update.desc ├── listfree ├── listfree.cocci └── listfree.desc ├── local ├── local.cocci └── local.desc ├── lock ├── o_lock_inconsistent.cocci └── o_lock_inconsistent.desc ├── lock_flags ├── flags1.cocci └── flags1.desc ├── lustre1 ├── lustre1.cocci └── lustre1.desc ├── lustre2 ├── lustre2.cocci ├── lustre2.desc ├── lustre2a.cocci └── lustre2a.desc ├── lustre3 ├── recast.cocci └── recast.desc ├── map_destroy ├── map_destroy.cocci └── map_destroy.desc ├── markbusy ├── usb_mark_last_busy.cocci └── usb_mark_last_busy.desc ├── mdiobus_unregister ├── mdiobus_unregister.cocci └── mdiobus_unregister.desc ├── mem2 ├── mem2.cocci └── mem2.desc ├── memdup ├── memdup.cocci └── memdup.desc ├── memdup_user ├── memdup_user.cocci └── memdup_user.desc ├── memuser ├── memuser.cocci └── memuser.desc ├── memzero ├── memzero_explicit.cocci └── memzero_explicit.desc ├── mesh ├── mesh.cocci └── mesh.desc ├── mini_lock ├── mini_lock.cocci └── mini_lock.desc ├── mini_null ├── mini_null_ref.cocci └── mini_null_ref.desc ├── mini_null3 ├── mini_null_ref3.cocci └── mini_null_ref3.desc ├── mini_null_check ├── mini_null_check.cocci ├── mini_null_check.desc ├── second_mini_null_check.cocci └── second_mini_null_check.desc ├── mini_null_ref_aug10 ├── mini_null_ref.cocci └── mini_null_ref.desc ├── mini_null_ref_aug14 ├── mini_null_ref.cocci └── mini_null_ref.desc ├── misaligned ├── misaligned.cocci └── misaligned.desc ├── misc_undo ├── send_m1.cocci ├── send_m1.desc ├── send_m2.cocci └── send_m2.desc ├── missing_put ├── missing_put.cocci └── missing_put.desc ├── moduleparam ├── rule5.cocci └── rule5.desc ├── more_of_noput ├── patch.cocci └── patch.desc ├── more_pci ├── get_slot.cocci ├── get_slot.desc ├── more_pci.cocci └── more_pci.desc ├── mutex ├── mut.cocci └── mut.desc ├── mutex2 ├── mutex2.cocci └── mutex2.desc ├── ndp ├── ndp.cocci └── ndp.desc ├── noderef ├── noderef.cocci └── noderef.desc ├── noderef2 ├── noderef2.cocci └── noderef2.desc ├── nonet ├── nonet.cocci └── nonet.desc ├── nopl ├── nopl.cocci └── nopl.desc ├── noreq ├── noreq.cocci └── noreq.desc ├── notnull ├── notnull.cocci ├── notnull.desc ├── notnull2.cocci └── notnull2.desc ├── null_ref ├── null_ref.cocci └── null_ref.desc ├── null_ref2 ├── mini_null_ref2.cocci └── mini_null_ref2.desc ├── obdalloc ├── obdalloc.cocci └── obdalloc.desc ├── obdalloc3 ├── obdalloc.cocci └── obdalloc.desc ├── obdalloclarge ├── obdalloclarge.cocci └── obdalloclarge.desc ├── obdcpt ├── obdcptalloc.cocci └── obdcptalloc.desc ├── obdfree ├── obdalloc.cocci └── obdalloc.desc ├── oddpe ├── oddpe.cocci └── oddpe.desc ├── of_noput ├── of_noput.cocci └── of_noput.desc ├── offset ├── offset.cocci └── offset.desc ├── ofiomap ├── of_iomap-iounmap.cocci └── of_iomap-iounmap.desc ├── ofnametype ├── ofname1.cocci ├── ofname1.desc ├── oftype1.cocci └── oftype1.desc ├── ofnodeget ├── ofnodeget.cocci ├── ofnodeget.desc ├── ofnodeget1.cocci ├── ofnodeget1.desc ├── ofnodeget2.cocci └── ofnodeget2.desc ├── ofnodeget3 ├── ofnodeget3.cocci └── ofnodeget3.desc ├── ofnodeget4 ├── ofnodeget4.cocci └── ofnodeget4.desc ├── ofredef ├── ofredef.cocci └── ofredef.desc ├── onp ├── onp.cocci └── onp.desc ├── orplus2 ├── orplus2.cocci └── orplus2.desc ├── osdi_isnull ├── osdi_isnull.cocci ├── osdi_isnull.desc ├── osdi_isnull3.cocci └── osdi_isnull3.desc ├── osdi_kfree ├── osdi_kfree.cocci └── osdi_kfree.desc ├── parport ├── sp8188.cocci └── sp8188.desc ├── parse_phandle ├── parse_phandle.cocci └── parse_phandle.desc ├── pci_add_put ├── pci_noputm.cocci └── pci_noputm.desc ├── pci_drop_put ├── pci_get.cocci └── pci_get.desc ├── pcicst ├── pcicst.cocci └── pcicst.desc ├── pciom ├── pciom3.cocci └── pciom3.desc ├── pcipower ├── pcipower.cocci └── pcipower.desc ├── pcr ├── pcr.cocci └── pcr.desc ├── pd ├── pd.cocci └── pd.desc ├── pfc0 ├── pfc0.cocci └── pfc0.desc ├── platret ├── platret.cocci └── platret.desc ├── pointless_err ├── pointless_err.cocci └── pointless_err.desc ├── prepare2 ├── prepare2.cocci └── prepare2.desc ├── ptr ├── ptr.cocci └── ptr.desc ├── ptrerr ├── ptrerr.cocci └── ptrerr.desc ├── put_after ├── put_after.cocci └── put_after.desc ├── put_deref ├── patch.cocci └── patch.desc ├── putty ├── putty.cocci └── putty.desc ├── rcu ├── rcu.cocci └── rcu.desc ├── reiserfs ├── category2a_open_xa_dir.cocci └── category2a_open_xa_dir.desc ├── remap_bar ├── remap_bar.cocci └── remap_bar.desc ├── remove ├── remove.cocci └── remove.desc ├── removed ├── removed.cocci └── removed.desc ├── reqrel2 ├── reqrel2.cocci └── reqrel2.desc ├── requests ├── diou.cocci ├── diou.desc ├── dirq.cocci └── dirq.desc ├── resource ├── reg.cocci ├── reg.desc ├── resource.cocci └── resource.desc ├── resource_fix1 ├── resource_fix1.cocci └── resource_fix1.desc ├── resource_size ├── resource_size.cocci └── resource_size.desc ├── ret0 ├── ret0.cocci └── ret0.desc ├── ret3 ├── ret3.cocci └── ret3.desc ├── ret4 ├── ret4.cocci └── ret4.desc ├── ret6 ├── ret6.cocci └── ret6.desc ├── retalloc ├── retalloc.cocci └── retalloc.desc ├── retest ├── retest.cocci └── retest.desc ├── rirqp ├── rirqp.cocci └── rirqp.desc ├── round ├── round.cocci └── round.desc ├── round2 ├── round.cocci └── round.desc ├── round_closest ├── round_closest.cocci └── round_closest.desc ├── rr ├── rr.cocci ├── rr.desc ├── rr1.cocci └── rr1.desc ├── rxrpc ├── category2a_rxrpc_get_transport.cocci └── category2a_rxrpc_get_transport.desc ├── s390 ├── category2a_dasd_kmalloc_request.cocci ├── category2a_dasd_kmalloc_request.desc ├── category2a_idal_buffer_alloc.cocci ├── category2a_idal_buffer_alloc.desc ├── s390.cocci └── s390.desc ├── semicolon ├── semicolon.cocci └── semicolon.desc ├── serial_core ├── serial_core.cocci └── serial_core.desc ├── setup_timer ├── setup_timer.cocci └── setup_timer.desc ├── signed ├── signed.cocci └── signed.desc ├── simple_kzalloc ├── simple_kzalloc1.cocci └── simple_kzalloc1.desc ├── simplify_ioremap_resource ├── simplify_ioremap_resource.cocci ├── simplify_ioremap_resource.desc ├── simplify_ioremap_resource2.cocci └── simplify_ioremap_resource2.desc ├── sin_family ├── sin_family.cocci └── sin_family.desc ├── sizeof ├── sizeof_sizeof.cocci └── sizeof_sizeof.desc ├── sizeof_notype ├── sizeof_notype.cocci └── sizeof_notype.desc ├── sla ├── sla.cocci └── sla.desc ├── slot ├── slot.cocci └── slot.desc ├── soc_sound ├── category2a_ssc_request.cocci └── category2a_ssc_request.desc ├── sockfd ├── patch.cocci └── patch.desc ├── static2 ├── static2.cocci └── static2.desc ├── stest ├── stest.cocci └── stest.desc ├── strsize ├── strsizeof.cocci └── strsizeof.desc ├── strtoul ├── simple.cocci └── simple.desc ├── sz ├── sz.cocci └── sz.desc ├── sz3 ├── sz3.cocci └── sz3.desc ├── targets ├── testeno ├── testeno.cocci └── testeno.desc ├── tinit ├── tinit.cocci └── tinit.desc ├── tipc ├── tipc.cocci └── tipc.desc ├── tty_port ├── sp10730.cocci └── sp10730.desc ├── typedef ├── handle.cocci ├── handle.desc └── hv │ ├── device_object │ ├── DEVICE_OBJECT.cocci │ └── DEVICE_OBJECT.desc │ ├── driver_object │ ├── DRIVER_OBJECT.cocci │ └── DRIVER_OBJECT.desc │ ├── netvsc │ ├── NETVSC_PACKET.cocci │ └── NETVSC_PACKET.desc │ └── storvsc │ ├── STORVSC_REQUEST.cocci │ └── STORVSC_REQUEST.desc ├── ubi ├── category2b_add_volume.cocci └── category2b_add_volume.desc ├── ubifs ├── category2a_kthread_create.cocci └── category2a_kthread_create.desc ├── ulfe ├── ulfe.cocci └── ulfe.desc ├── unarray ├── unarray.cocci └── unarray.desc ├── undevm ├── undevm.cocci └── undevm.desc ├── unsf ├── unsf.cocci ├── unsf.desc ├── unsf_ret0.cocci └── unsf_ret0.desc ├── unused ├── unused.cocci └── unused.desc ├── unused_err ├── unused_err.cocci └── unused_err.desc ├── unused_var_kfree ├── unused_var_kfree.cocci └── unused_var_kfree.desc ├── urb2 ├── urb2.cocci └── urb2.desc ├── urb8 ├── urb8.cocci └── urb8.desc ├── usb ├── category2a_back_device_reg.cocci ├── category2a_back_device_reg.desc ├── category2a_isp1760_reg.cocci └── category2a_isp1760_reg.desc ├── usbdata ├── usb_get_intfdata.cocci ├── usb_get_intfdata.desc ├── usb_set_intfdata.cocci └── usb_set_intfdata.desc ├── usbdir ├── end.cocci └── end.desc ├── use_freed_specific ├── bad_kfree.cocci └── bad_kfree.desc ├── usefreed ├── bad_kfree.cocci └── bad_kfree.desc ├── useless2 ├── useless2.cocci └── useless2.desc ├── uselesskfree ├── uselesskfree.cocci └── uselesskfree.desc ├── usnic ├── usnic.cocci └── usnic.desc ├── video ├── patch.cocci └── patch.desc ├── videobuf_dvb_get_frontend_return_null ├── videobuf_dvb_get_frontend_return_null.cocci └── videobuf_dvb_get_frontend_return_null.desc ├── warn ├── warn.cocci └── warn.desc ├── warn2 ├── warn2.cocci └── warn2.desc ├── write2 ├── write2.cocci └── write2.desc ├── wrongcheck ├── wrongcheck.cocci └── wrongcheck.desc ├── wrongtest ├── wrongtest.cocci └── wrongtest.desc ├── x25 ├── patch.cocci └── patch.desc ├── xand ├── xand.cocci └── xand.desc ├── xfrm ├── category2a_xfrm_bundle_create.cocci └── category2a_xfrm_bundle_create.desc ├── zercst ├── zercst.cocci └── zercst.desc └── zero ├── rezero.cocci └── rezero.desc /9p/category2a_p9_client_walk.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use an IS_ERR test rather than a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | In case of error, the function p9_client_walk returns an ERR pointer, 8 | but never returns a NULL pointer. So a NULL test that comes after an 9 | IS_ERR test should be deleted. 10 | -------------------------------------------------------------------------------- /9p/p9_client_walk.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use an IS_ERR test rather than a NULL test 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julien Brunel 8 | // Author: Julia Lawall 9 | // URL: http://coccinelle.lip6.fr/ 10 | // URL: http://coccinellery.org/ 11 | 12 | @match_bad_null_test@ 13 | expression x, E; 14 | statement S1,S2; 15 | @@ 16 | x = p9_client_walk(...) 17 | ... when != x = E 18 | * if (x != NULL) 19 | S1 else S2 20 | -------------------------------------------------------------------------------- /9p/p9_client_walk.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use an IS_ERR test rather than a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | In case of error, the function p9_client_walk returns an ERR pointer, 8 | but never returns a NULL pointer. So a NULL test that comes after an 9 | IS_ERR test should be deleted. 10 | -------------------------------------------------------------------------------- /CONTRIB/README: -------------------------------------------------------------------------------- 1 | This directory is used for adding your semantic patches to Coccinellery. 2 | Create a directory for you and put all semantic patches inside your directory. 3 | 4 | For each .cocci file, please create a .desc file. There are examples of .desc 5 | files on the repository. 6 | 7 | If you want a new target, add it to: 8 | 1 - targets file on the root directory of the Coccinellery repository: 9 | github.com/coccinelle/coccinellery/blob/master/targets 10 | 11 | 2 - html template 12 | github.com/coccinellery/coccinellery.github.com/blob/master/template/header.html 13 | 14 | -------------------------------------------------------------------------------- /CONTRIB/firehose/README: -------------------------------------------------------------------------------- 1 | The semantic patches in this folder are meant to be used for Firehose 2 | export. 3 | 4 | Firehose is an XML grammar whose intent is to have a common format for 5 | many static analysis tools. 6 | You can find more information about Firehose at: 7 | https://github.com/fedora-static-analysis/firehose 8 | 9 | In order to get a Firehose-compatible output, these patches use the 10 | Coccinelle module xml_firehose, which is located in python/coccilib/. 11 | 12 | If you want to use it, you have to pass the option "-D firehose " to 13 | spatch. 14 | -------------------------------------------------------------------------------- /CONTRIB/firehose/arref/arref.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | for(e1 = 0; e1 < e2; e1++) { 3 | ar[e2] = 12; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /CONTRIB/firehose/arref/arref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Adjust array index 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert array index from the loop bound to the loop index. 7 | -------------------------------------------------------------------------------- /CONTRIB/firehose/badand/badand.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (!x && !x->y) return 12; 3 | if (x || x->y) return 12; 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIB/firehose/badand/badand.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Convert && to || 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The pattern !E && !E->fld is nonsensical. The patch below updates this 7 | according to the assumption that && should be ||. But perhaps another 8 | solution was intended. 9 | -------------------------------------------------------------------------------- /CONTRIB/firehose/badkm2/badkm2.c: -------------------------------------------------------------------------------- 1 | int main() { 2 | int ret; 3 | ret = -1; 4 | while(y) { 5 | if (x) return ret; 6 | ret = foo(); 7 | if (ret < 0) return ret; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CONTRIB/firehose/bitcall/bitcall.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (!x & !y) return 12; 3 | } 4 | -------------------------------------------------------------------------------- /CONTRIB/firehose/bitcall/bitcall.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = convert & to && 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The use of & to obtain a conjunction that evaluates both of its arguments 7 | seems unnecessarily tricky. 8 | -------------------------------------------------------------------------------- /CONTRIB/firehose/da/da.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | x = 12; 3 | x = 12; 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIB/firehose/da/da.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Correct double assignment 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The double assignment is meant to be a bit-or to combine two values. 7 | -------------------------------------------------------------------------------- /CONTRIB/firehose/double_null/double_null.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (x == NULL) return 5; 3 | if (x == NULL) return 12; 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIB/firehose/double_null/double_null.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Correct NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Test the value that was just allocated rather than the previously tested one. 7 | -------------------------------------------------------------------------------- /CONTRIB/firehose/doubleinit/doubleinit.c: -------------------------------------------------------------------------------- 1 | struct foo x = { .x = 3, .x = 3}; 2 | -------------------------------------------------------------------------------- /CONTRIB/firehose/doubleinit/doubleinit.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Remove duplicate structure field initialization 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The definition of uml_netdev_ops has initializations of a local function 7 | and eth_mac_addr for its ndo_set_mac_address field. This change uses only 8 | the local function. 9 | -------------------------------------------------------------------------------- /CONTRIB/firehose/doubletest/doubletest.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (x && x) return 0; 3 | } 4 | -------------------------------------------------------------------------------- /CONTRIB/firehose/doubletest/doubletest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Remove double test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The current code tests the gpio_vid0 field twice. Test the gpio_vid1 7 | fields in place of the second gpio_vid0 test. 8 | -------------------------------------------------------------------------------- /CONTRIB/firehose/drop_continue/drop_continue.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | while (x) 3 | if (y) 4 | continue; 5 | } 6 | 7 | int xxx () { 8 | for (x=0; x!=10; x++) 9 | if (y) 10 | continue; 11 | } 12 | -------------------------------------------------------------------------------- /CONTRIB/firehose/drop_continue/drop_continue.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Drop unnecessary continue 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Continue is not needed at the bottom of a loop. 7 | -------------------------------------------------------------------------------- /CONTRIB/firehose/if-semicolon/if-semicolon.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (x && x); 3 | return 0; 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIB/firehose/if-semicolon/if-semicolon.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Detect semicolon after if 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Detect a semicolon after if(...) that is preventing the error check to 7 | work correctly. Removing this semicolon will change the code behavior, 8 | but this is intended. 9 | -------------------------------------------------------------------------------- /CONTRIB/firehose/ifaddr/ifaddr.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (&x) return 0; 3 | } 4 | -------------------------------------------------------------------------------- /CONTRIB/firehose/ifaddr/ifaddr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Test of a variable/field address 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | coccinellery-author1 = Gilles Muller 7 | the address of a variable or field is non-zero is likely always to bo 8 | non-zero 9 | -------------------------------------------------------------------------------- /CONTRIB/firehose/noderef/noderef.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Correct size computation 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The size argument to kcalloc should be the size of desired structure, 7 | not the pointer to it. 8 | -------------------------------------------------------------------------------- /CONTRIB/firehose/ret/ret.c: -------------------------------------------------------------------------------- 1 | int main () { 2 | if (x) 3 | return 0; return 0; 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIB/firehose/ret/ret.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Firehose 2 | coccinellery-short = Useless goto and return 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Useless goto and return 7 | -------------------------------------------------------------------------------- /acl/patch.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing call to posix_acl_release 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | posix_acl_clone does a memory allocation and sets a reference count, so 7 | posix_acl_release is needed afterwards to free it. 8 | -------------------------------------------------------------------------------- /acpi/category2b_back_device_reg.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Dereference without an error test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | After a variable is assigned the result of backlight_device_register, an error 8 | test should be performed before a dereference. 9 | -------------------------------------------------------------------------------- /acpid/acpi.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Drop uses of acpi_driver_data 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | struct acpi_device *d; 13 | @@ 14 | 15 | - acpi_driver_data(d) 16 | + d->driver_data 17 | 18 | -------------------------------------------------------------------------------- /acpid/acpi.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop uses of acpi_driver_data 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Drop uses of acpi_driver_data 7 | -------------------------------------------------------------------------------- /ainerr/ainerr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /alloc9/kmalloc9.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | __ip_vs_service_get and __ip_vs_svc_fwm_get increment a reference count, so 7 | that reference count should be decremented before leaving the function in an 8 | error case. 9 | -------------------------------------------------------------------------------- /alloc_cast/alloc_cast.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Drop memory allocation cast 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | @@ 14 | 15 | - (T *) 16 | (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| 17 | kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...)) 18 | 19 | -------------------------------------------------------------------------------- /alloc_cast/alloc_cast.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop memory allocation cast 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Drop cast on the result of kmalloc and similar functions. 7 | -------------------------------------------------------------------------------- /alloc_domain/easykmret.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing free_domain_mem 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add missing free_domain_mem on failure path after alloc_domain. 7 | -------------------------------------------------------------------------------- /alloc_etherdev/alloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust error handling after call to alloc_etherdev() 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Detect possible error handling code related to alloc_etherdev(). 7 | -------------------------------------------------------------------------------- /alloc_tty/alloc_tty.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = add missing put_tty_driver 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | alloc_tty_driver is called at the beginning of the function containing the 7 | lines of code shown in the patch. Thus, put_tty_driver is needed before 8 | returning in the error handling code. 9 | -------------------------------------------------------------------------------- /allocs/a2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing fput 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | fget increments a reference count, so fput is needed to decrement it. I 7 | have added a goto to the end of the function where there was already such a 8 | call. 9 | -------------------------------------------------------------------------------- /array_and_size/array_and_size_clean.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use ARRAY_AND_SIZE consistently 3 | coccinellery-copyright = Copyright: 2014 - LIP6/INRIA 4 | coccinellery-license = Licensed under GPLv2 or any later version. 5 | coccinellery-author0 = Julia Lawall 6 | Because ARRAY_AND_SIZE changes the apparent arity of a function, if it is 7 | used for one call to a given function, it would be better, if possible, to 8 | use it for all of them. 9 | -------------------------------------------------------------------------------- /arraysize/array.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use ARRAY_SIZE 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | ARRAY_SIZE is more concise to use when the size of an array is divided by 7 | the size of its type or the size of its first element. 8 | -------------------------------------------------------------------------------- /arraytest/arraytest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = delete unnecessary null test on array 3 | coccinellery-copyright = Copyright: 2014 - LIP6/INRIA 4 | coccinellery-license = Licensed under GPLv2 or any later version. 5 | coccinellery-author0 = Julia Lawall 6 | Delete NULL test on array (always false) 7 | -------------------------------------------------------------------------------- /arref/arref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Adjust array index 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert array index from the loop bound to the loop index. 7 | -------------------------------------------------------------------------------- /asprintf/asprintf.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kasprintf 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | kasprintf combines kmalloc and sprintf, and takes care of the size 7 | calculation itself. 8 | -------------------------------------------------------------------------------- /atm/atm.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // add missing atm_dev_put 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x, E; 13 | constant C; 14 | @@ 15 | 16 | x = atm_dev_lookup(...); 17 | ... when != false x != NULL 18 | when != true x == NULL 19 | when != \(E = x\|x = E\) 20 | when != atm_dev_put(dev); 21 | *return -C; 22 | -------------------------------------------------------------------------------- /atm/atm.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = add missing atm_dev_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The earlier call to atm_dev_lookup increases the reference count of dev, 7 | so decrease it on the way out. 8 | -------------------------------------------------------------------------------- /auth/auth.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust error handling code involving auth_domain_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Once clp is assigned, it never becomes NULL, so we can make a label for it 7 | in the error handling code. Because the call to path_lookup follows the 8 | call to auth_domain_find, its error handling code should jump to this new 9 | label. 10 | -------------------------------------------------------------------------------- /badand/badand.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Convert && to || 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E; 13 | identifier fld; 14 | @@ 15 | 16 | - !E && !E->fld 17 | + !E || !E->fld 18 | 19 | @@ 20 | expression E; 21 | identifier fld; 22 | @@ 23 | 24 | - E || E->fld 25 | + E && E->fld 26 | -------------------------------------------------------------------------------- /badand/badand.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Convert && to || 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The pattern !E && !E->fld is nonsensical. The patch below updates this 7 | according to the assumption that && should be ||. But perhaps another 8 | solution was intended. 9 | -------------------------------------------------------------------------------- /badcheck/badcheck.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // fix devm_ioremap_resource error detection code 3 | // 4 | // Target: Linux 5 | // Copyright: Copyright: 2014 - LIP6/INRIA 6 | // License: Licensed under GPLv2 or any later version. 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e,e1; 13 | statement S; 14 | @@ 15 | 16 | *e = devm_ioremap_resource(...); 17 | if (!e1) S 18 | 19 | -------------------------------------------------------------------------------- /badcheck/badcheck.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = fix devm_ioremap_resource error detection code 3 | coccinellery-copyright = Copyright: 2014 - LIP6/INRIA 4 | coccinellery-license = Licensed under GPLv2 or any later version. 5 | coccinellery-author0 = Julia Lawall 6 | devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure. 7 | Furthermore, the value returned by devm_ioremap_resource should be tested. 8 | -------------------------------------------------------------------------------- /badftest/badftest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Test the just-allocated value for NULL rather than some other value. 7 | -------------------------------------------------------------------------------- /badkm/badkm.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Initialize return variable with error code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Typically, the return value desired for the failure of a memory allocation 7 | is -ENOMEM. In this case, the return value is undesirably 0. 8 | -------------------------------------------------------------------------------- /badktest/badktest.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct NULL test 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x,y; 13 | statement S; 14 | @@ 15 | 16 | x = \(kmalloc\|kcalloc\|kzalloc\)(...); 17 | ( 18 | if ((x) == NULL) S 19 | | 20 | if ( 21 | - y 22 | + x 23 | == NULL) 24 | S 25 | ) 26 | -------------------------------------------------------------------------------- /badktest/badktest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Test the just-allocated value for NULL rather than some other value. 7 | -------------------------------------------------------------------------------- /badmsg/badmsg.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Return -ENOMEM on memory allocation failure 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In this code, 0 is returned on memory allocation failure, even though other 7 | failures return -ENOMEM or other similar values. 8 | -------------------------------------------------------------------------------- /badmsg3/badmsg3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct return value on error handling 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Correct return value on error handling 7 | -------------------------------------------------------------------------------- /badpt/badpt.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /badty/badty.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct the size argument to kzalloc 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @disable sizeof_type_expr@ 12 | type T; 13 | T **x; 14 | @@ 15 | 16 | x = 17 | <+...sizeof( 18 | - T 19 | + *x 20 | )...+> 21 | -------------------------------------------------------------------------------- /badty/badty.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct the size argument to kzalloc 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | obj has type struct snmp_object **, not struct snmp_object *. But indeed 7 | it is not even clear why kmalloc is needed. The memory is freed by the end 8 | of the function, so the local variable of pointer type should be sufficient. 9 | -------------------------------------------------------------------------------- /bitcall/bitcall.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // convert & to && 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ expression E1, E2; @@ 12 | * !E1 & !E2 13 | -------------------------------------------------------------------------------- /bitcall/bitcall.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = convert & to && 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The use of & to obtain a conjunction that evaluates both of its arguments 7 | seems unnecessarily tricky. 8 | -------------------------------------------------------------------------------- /bits/notand.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct use of ! and & 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ expression E1,E2; @@ 12 | ( 13 | !E1 & !E2 14 | | 15 | - !E1 & E2 16 | + !(E1 & E2) 17 | ) 18 | -------------------------------------------------------------------------------- /bits2/notand.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct use of ! and & 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ expression E; constant C; @@ 12 | ( 13 | !E & !C 14 | | 15 | - !E & C 16 | + !(E & C) 17 | ) 18 | -------------------------------------------------------------------------------- /bits2/notand.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct use of ! and & 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Correct priority problem in the use of ! and &. 7 | -------------------------------------------------------------------------------- /block_nil/retsall.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use BLOCK_NIL 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use BLOCK_NIL consistently rather than sometimes 0xffff and sometimes 7 | BLOCK_NIL. 8 | -------------------------------------------------------------------------------- /bo/bo.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // use BUG_ON 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | identifier x; 13 | @@ 14 | 15 | -if (x) BUG(); 16 | +BUG_ON(x); 17 | 18 | @@ 19 | identifier x; 20 | @@ 21 | 22 | -if (!x) BUG(); 23 | +BUG_ON(!x); 24 | 25 | -------------------------------------------------------------------------------- /bo/bo.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use BUG_ON 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use BUG_ON(x) rather than if(x) BUG(); 7 | -------------------------------------------------------------------------------- /bond/short_timeout.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Adjust constant name 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | struct port_params p; 13 | @@ 14 | 15 | * p.port_state |= AD_SHORT_TIMEOUT 16 | -------------------------------------------------------------------------------- /bond/short_timeout.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust constant name 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | AD_SHORT_TIMEOUT and AD_STATE_LACP_ACTIVITY have the same value, but 7 | AD_STATE_LACP_ACTIVITY better reflects the intended semantics. 8 | -------------------------------------------------------------------------------- /bss/sp1094.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing call to cfg80211_put_bss 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | A call to cfg80211_get_bss hould be accompanied by a call to 7 | cfg80211_put_bss in error-handling code. 8 | -------------------------------------------------------------------------------- /btrfs/btrfs.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing btrfs_free_path 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Btrfs_alloc_path should be matched with btrfs_free_path in error-handling code. 7 | -------------------------------------------------------------------------------- /bugon/newbugon.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use BUG_ON 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | if (...) BUG(); should be replaced with BUG_ON(...) when the test has no 7 | side-effects to allow a definition of BUG_ON that drops the code completely. 8 | -------------------------------------------------------------------------------- /c99/c99.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /cache/cache.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use kmem_cache_free 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x,E,c; 13 | @@ 14 | 15 | x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...) 16 | ... when != x = E 17 | when != &x 18 | ?-kfree(x) 19 | +kmem_cache_free(c,x) 20 | -------------------------------------------------------------------------------- /cache/cache.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kmem_cache_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather 7 | than kfree. 8 | -------------------------------------------------------------------------------- /call_kern3/call_kern3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use GFP_ATOMIC when a lock is held 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The containing function is called from several places. At one of them, in 7 | the function untag_chunk, the spin lock &entry->lock is held. 8 | -------------------------------------------------------------------------------- /capi/capi.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust error handling code involving capi_ctr_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | After calling capi_ctr_get, error handling code should call 7 | capi_ctr_put. 8 | -------------------------------------------------------------------------------- /castnet/castnet.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /checkdoc/checkdoc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /clkderef/clkderef.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use clk API instead of direct dereferences 3 | // 4 | // Target: Linux 5 | // Copyright: Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e,e1; 13 | identifier i; 14 | @@ 15 | 16 | *e = clk_get(...) 17 | ... when != e = e1 18 | when any 19 | *e->i -------------------------------------------------------------------------------- /clkderef/clkderef.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use clk API instead of direct dereferences 3 | coccinellery-copyright = Copyright: 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | A struct clk value is intended to be an abstract pointer, so it should be 7 | manipulated using the various API functions. 8 | -------------------------------------------------------------------------------- /clkput/clkput.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing clk_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Reorder the labels at the end of the function to correspond to the order in 7 | which the resources are allocated. 8 | -------------------------------------------------------------------------------- /compare/compare.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_component_ops/const_component_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_dvb_tuner_ops/const_dvb_tuner_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_ethtool/const_ethtool.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_fb_fix_screeninfo/const_fb_fix_screeninfo.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_fb_fix_screeninfo/const_fb_var_screeninfo.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_gpio_chip/const_gpio_chip.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_i2c_adapter_quirks/const_i2c_adapter_quirks.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_i2c_algo/const_i2c_alg.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_iio_info/const_iio_info.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_l3mdev_ops/const_l3mdev_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_net_device_ops/const_net_device_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_pinctrl/const_pinctrl.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_rtc_class_ops/const_rtc_class_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_snd_pcm_ops/const_snd_pcm_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_snd_soc_codec_driver/const_snd_soc_codec_driver.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_snd_soc_ops/const_snd_soc_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_uart/const_uart_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /const_watchdog_ops/const_watchdog_ops.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /consts/consts.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use the constant InterlaceMode 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the constant InterlaceMode rather than the magic number 0x0080. 7 | -------------------------------------------------------------------------------- /countptr/countptr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove exceptional & on function name 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In this file, function names are otherwise used as pointers without &. 7 | -------------------------------------------------------------------------------- /cpu/cpu.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust error handling code involving cpufreq_cpu_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | After calling cpufreq_cpu_get, error handling code should call 7 | cpufreq_cpu_put. 8 | -------------------------------------------------------------------------------- /cpu_mask/cpu_mask.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use set_cpus_allowed_ptr 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use set_cpus_allowed_ptr rather than set_cpus_allowed. 7 | -------------------------------------------------------------------------------- /cpufreq/patch.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add calls to cpufreq_cpu_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | A call to cpufreq_cpu_get should be matched by a call to cpufreq_cpu_put. 7 | -------------------------------------------------------------------------------- /cris/mutex2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use mutex_unlock rather than spin_unlock 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | It looks at least odd to apply spin_unlock to a mutex. 7 | -------------------------------------------------------------------------------- /cspage/cspage.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /cstptr/cstptr.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Move call to PTR_ERR after reassignment 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e,e1; 13 | constant c; 14 | @@ 15 | 16 | *e = c 17 | ... when != e = e1 18 | when != &e 19 | when != true IS_ERR(e) 20 | *PTR_ERR(e) -------------------------------------------------------------------------------- /cstptr/cstptr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Move call to PTR_ERR after reassignment 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | PTR_ERR should be called before its argument is cleared. 7 | -------------------------------------------------------------------------------- /ctu/ctu.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Initialize all fields 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The c32 structure is allocated on the stack and its idx field is not 7 | initialized before copying it to user level. This patch takes the value 8 | from the result of the ioctl, as done for the other fields. 9 | -------------------------------------------------------------------------------- /da/da.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Correct double assignment 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The double assignment is meant to be a bit-or to combine two values. 7 | -------------------------------------------------------------------------------- /da2/da2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /dall/dall.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use devm_ functions consistently 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | @@ 13 | 14 | *devm_kzalloc(...) 15 | ... 16 | *kzalloc(...) -------------------------------------------------------------------------------- /dca/constify.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /dca/onlyfunctions.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /delt/delt.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /deltr/deltr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /depspin/sl.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use DEFINE_SPINLOCK 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | SPIN_LOCK_UNLOCKED is deprecated. The semantic patch makes the change 7 | suggested in Documentation/spinlocks.txt 8 | -------------------------------------------------------------------------------- /derefnull/isnull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Detect null dereference and unnecessary test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Detect null dereference and unnecessary test 7 | -------------------------------------------------------------------------------- /destroy/destroy.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /device_attrs/device_attrs.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /device_attrs2/device_attrs2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /devm2a/devm2i.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use devm_ functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The various devm_ functions allocate memory that is released when a driver 7 | detaches. This patch uses these functions for data that is allocated in 8 | the probe function of a platform device and is only freed in the remove 9 | function. 10 | -------------------------------------------------------------------------------- /devm2i_0730/devm2i.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use devm_ functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The various devm_ functions allocate memory that is released when a driver 7 | detaches. This patch uses these functions for data that is allocated in 8 | the probe function of a platform device and is only freed in the remove 9 | function. 10 | -------------------------------------------------------------------------------- /devm2i_0730/request_and_ioremap.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use devm_ functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The various devm_ functions allocate memory that is released when a driver 7 | detaches. This patch uses these functions for data that is allocated in 8 | the probe function of a platform device and is only freed in the remove 9 | function. 10 | -------------------------------------------------------------------------------- /devm2i_aug25/devm2i.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use devm_ functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The various devm_ functions allocate memory that is released when a driver 7 | detaches. This patch uses these functions for data that is allocated in 8 | the probe function of a platform device and is only freed in the remove 9 | function. 10 | -------------------------------------------------------------------------------- /devm2i_aug25/request_and_ioremap.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use devm_ functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The various devm_ functions allocate memory that is released when a driver 7 | detaches. This patch uses these functions for data that is allocated in 8 | the probe function of a platform device and is only freed in the remove 9 | function. 10 | -------------------------------------------------------------------------------- /devm4/devm4.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop iounmap for devm_ allocated data 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Data allocated with devm_ioremap or devm_ioremap_nocache should not be 7 | freed using iounmap, because doing so causes a dangling pointer, and a 8 | subsequent double free. 9 | -------------------------------------------------------------------------------- /devm6/devm6.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use devm_request_and_ioremap 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Reimplement a call to devm_request_mem_region followed by a call to ioremap 7 | or ioremap_nocache by a call to devm_request_and_ioremap. 8 | -------------------------------------------------------------------------------- /devmir/devmir.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /devname/devname.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Eliminate NULL dereference 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression dev,E; 13 | @@ 14 | 15 | *dev_name(dev) 16 | ... when != dev = E 17 | ( 18 | *dev == NULL 19 | | 20 | *dev != NULL 21 | ) -------------------------------------------------------------------------------- /devname/devname.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Eliminate NULL dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | dev_name always dereferences its argument, so it should not be called if 7 | the argument is NULL. The function indeed later tests the argument for 8 | being NULL. 9 | -------------------------------------------------------------------------------- /diou/diou.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // drop kfree of devm_kzalloc's data 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x; 13 | @@ 14 | 15 | x = devm_kzalloc(...) 16 | ... 17 | ?-kfree(x); -------------------------------------------------------------------------------- /diou/diou.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = drop kfree of devm_kzalloc's data 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Using kfree to free data allocated with devm_kzalloc causes double frees. 7 | -------------------------------------------------------------------------------- /diou2/diou.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Drop devm_kfree of devm_kzalloc'd data 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x,d; 13 | @@ 14 | 15 | x = devm_kzalloc(...) 16 | ... 17 | ?-devm_kfree(d,x); -------------------------------------------------------------------------------- /diou2/diou.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop devm_kfree of devm_kzalloc'd data 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | devm_kfree should not have to be explicitly used. 7 | -------------------------------------------------------------------------------- /dma/set_dma_mode_1.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Avoid using magic number in set_dma_mode 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ expression E1; identifier I; constant int C; @@ 12 | ( 13 | set_dma_mode(E1,I,...) 14 | | 15 | *set_dma_mode(E1,C,...) 16 | ) 17 | 18 | -------------------------------------------------------------------------------- /dma/set_dma_mode_1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Avoid using magic number in set_dma_mode 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The constant DMA_RX_MODE is defined to be 0x14 in the local include file 7 | cs89x0.h. Since a constant with the same name is used elsewhere with 8 | set_dma_mode, it seems likely that this constant could be used here. 9 | -------------------------------------------------------------------------------- /dmaz/dmaz.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /double_call/dc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Eliminate useless code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The variable client is initialized twice to the same (side effect-free) 7 | expression. Drop one initialization. 8 | -------------------------------------------------------------------------------- /double_error_check/double_error_check.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /double_lock/double_lock.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate a double lock 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The path around the loop ends with the lock held, so the call to mutex_lock 7 | is moved before the beginning of the loop. 8 | -------------------------------------------------------------------------------- /double_null/double_null.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Correct NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Test the value that was just allocated rather than the previously tested one. 7 | -------------------------------------------------------------------------------- /double_test/double_test.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Introduce missing initialization 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The result of one call to a function is tested, and then at the second call 7 | to the same function, the previous result, and not the current result, is 8 | tested again. 9 | -------------------------------------------------------------------------------- /doublefree/frees.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate double kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The destination of goto error also does a kfree(g_iommus), so it is not 7 | correct to do one here. 8 | -------------------------------------------------------------------------------- /doubleinit/doubleinit.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Remove duplicate structure field initialization 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The definition of uml_netdev_ops has initializations of a local function 7 | and eth_mac_addr for its ndo_set_mac_address field. This change uses only 8 | the local function. 9 | -------------------------------------------------------------------------------- /doublermr/doublermr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Improve error handling 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | This code had an error handling goto to the wrong place, a misplaced 7 | release_mem_region, and a duplicated release_mem_region. 8 | -------------------------------------------------------------------------------- /doubleskb/doubleskb.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /doubletest/doubletest.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Remove double test 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @expression@ 12 | expression E; 13 | @@ 14 | 15 | * E 16 | || ... || E 17 | 18 | @expression@ 19 | expression E; 20 | @@ 21 | 22 | * E 23 | && ... && E 24 | -------------------------------------------------------------------------------- /doubletest/doubletest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove double test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The current code tests the gpio_vid0 field twice. Test the gpio_vid1 7 | fields in place of the second gpio_vid0 test. 8 | -------------------------------------------------------------------------------- /doubletest_high/doubletest_highconfidence.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Adjust double test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Rewrite a duplicated test to test the correct value 7 | -------------------------------------------------------------------------------- /drop_continue/cont.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Drop unnecessary continue 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Continue is not needed at the bottom of a loop. 7 | -------------------------------------------------------------------------------- /drvdata/drvdata.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use dev_set_drvdata 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Eliminate direct accesses to the driver_data field. 7 | -------------------------------------------------------------------------------- /dst/dst.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use dst_type field instead of type_flags 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | It seems from other code that it is the dst_type field rather than the 7 | type_flags field that contains values of the form DST_TYPE_IS... 8 | The type_flags field contains values of the form DST_TYPE_HAS... 9 | -------------------------------------------------------------------------------- /enter/enter.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Convert func_enter to func_exit 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | @@ 13 | 14 | - func_enter(); 15 | + func_exit(); 16 | return...; -------------------------------------------------------------------------------- /enter/enter.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Convert func_enter to func_exit 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert calls to func_enter on leaving a function to func_exit. 7 | -------------------------------------------------------------------------------- /errcast/errcast.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // use ERR_CAST 3 | // 4 | // Target: Linux 5 | // Copyright: Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | // Target: Linux 12 | 13 | @@ 14 | expression err,x; 15 | @@ 16 | 17 | - err = PTR_ERR(x); 18 | if (IS_ERR(x)) 19 | - return ERR_PTR(err); 20 | + return ERR_CAST(x); 21 | -------------------------------------------------------------------------------- /errcast/errcast.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use ERR_CAST 3 | coccinellery-copyright = Copyright: 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | ERR_CAST is more concise than PTR_ERR followed by ERR_PTR. Using it 7 | also occasionally removes the need for an err variable. 8 | -------------------------------------------------------------------------------- /even_more_pci/get_slot.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing pci_dev_get 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | pci_get_slot does a pci_dev_get, so pci_dev_put needs to be called in an 7 | error case. 8 | In the first three cases, it might also be possible to move the call to 9 | pci_get_slot downwards below the error handling code. 10 | -------------------------------------------------------------------------------- /exact/exact.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /export5/export5.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /export_static/export4.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /extra_put/extra_put.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop unneeded of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | After using for_each_node_by_name, there is no need for of_node_put unless 7 | there was a break in the loop body, as for_each_node_by_name does a 8 | of_node_put on each of the elements it returns. 9 | -------------------------------------------------------------------------------- /fbrelease/patch.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // eliminate double free 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E; 13 | @@ 14 | 15 | * kfree(E); 16 | ... 17 | * framebuffer_release(E); 18 | 19 | @@ 20 | expression E; 21 | @@ 22 | 23 | * framebuffer_release(E); 24 | ... 25 | * kfree(E); 26 | -------------------------------------------------------------------------------- /fen/fen.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop unnecessary of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | for_each_node_by_name only exits when its first argument is NULL, and a 7 | subsequent call to of_node_put on that argument is unnecessary. 8 | -------------------------------------------------------------------------------- /ffz/ffz.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /fields/field.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use FIELD_SIZEOF 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code 7 | that matches its definition. 8 | -------------------------------------------------------------------------------- /for_each_child1/for_each_child1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /for_each_child1/for_each_child1_ext.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /for_each_child2/for_each_child2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /for_each_child5/for_each_child5.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /freenull/freenull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /frfr/frfr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate double free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The few lines below the kfree of hdr_buf may go to the label err_free which 7 | will also free hdr_buf. The most straightforward solution seems to be to 8 | just move the kfree of hdr_buf after these gotos. 9 | -------------------------------------------------------------------------------- /ftl/ftl.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /func/func.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /fuse/fuse.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing fuse_request_alloc 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The error handling code for the second call to fuse_request_alloc should 7 | include freeing the result of the first one. 8 | -------------------------------------------------------------------------------- /gdth/gdth.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing call to gdth_ioctl_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add missing call to gdth_ioctl_free before aborting. 7 | -------------------------------------------------------------------------------- /getprop/getprop.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /getprop2/getprop2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /gmc/gmc.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Avoid call to genlmsg_cancel 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression data; 13 | @@ 14 | 15 | if (data == NULL) { ... 16 | * genlmsg_cancel(..., data); 17 | ... 18 | return ...; 19 | } -------------------------------------------------------------------------------- /handle/handle.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In this code, it is possible to tell statically whether usblp will be NULL 7 | in the error handling code. 8 | Another option would have been to put a label directly on the return. 9 | -------------------------------------------------------------------------------- /hrtimer/hrtimer.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use function hrtimer_is_queued 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the hrtimer_is_queued function rather than an explicit bit-and for 7 | testing timer->state, as done elsewhere. 8 | -------------------------------------------------------------------------------- /i2c_msg/i2c_msg.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use macros for i2c_msg initialization 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Introduce use of I2c_MSG_READ/WRITE/OP, for readability. 7 | In the second i2c_msg structure, a length expressed as an explicit constant 8 | is also re-expressed as the size of the buffer, reg. 9 | -------------------------------------------------------------------------------- /i915/sp1517.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The cleanup code at the end of the function should also be carried out when 7 | the function only partly completes its work. 8 | -------------------------------------------------------------------------------- /ie2/ie2.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Convert IS_ERR result to PTR_ERR 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x; 13 | @@ 14 | 15 | if (...) { ... 16 | - return IS_ERR(x); 17 | + return PTR_ERR(x); 18 | } 19 | -------------------------------------------------------------------------------- /ie2/ie2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Convert IS_ERR result to PTR_ERR 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | This code elsewhere returns a negative constant to an indicate an error, 7 | while IS_ERR returns the result of a >= operation. 8 | -------------------------------------------------------------------------------- /if-semicolon/if-semicolon.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Detect semicolon after if 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Peter Senna Tschudin 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @r1@ 12 | position p; 13 | @@ 14 | if (...);@p 15 | 16 | @script:python@ 17 | p0 << r1.p; 18 | @@ 19 | // Emacs org-mode output 20 | cocci.print_main("", p0) 21 | cocci.print_secs("", p0) 22 | -------------------------------------------------------------------------------- /if-semicolon/if-semicolon.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Detect semicolon after if 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Detect a semicolon after if(...) that is preventing the error check to 7 | work correctly. Removing this semicolon will change the code behavior, 8 | but this is intended. 9 | -------------------------------------------------------------------------------- /ifcol/ifcol.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust confusing if indentation 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Outdent the code following the if. 7 | -------------------------------------------------------------------------------- /iff/iff.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Fix error return code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert a possibly 0 error return code to a negative one, as returned 7 | elsewhere in the function. 8 | -------------------------------------------------------------------------------- /init/useful_inits3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /input/sp2486.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct call to input_free_device 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Correct call to input_free_device 7 | -------------------------------------------------------------------------------- /input/sp2495.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct call to input_free_device 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Correct call to input_free_device 7 | -------------------------------------------------------------------------------- /input/sp2506.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct call to input_free_device 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Correct call to input_free_device 7 | -------------------------------------------------------------------------------- /iom/devm2i.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing iounmap 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add missing iounmap in error handling code, in a case where the function 7 | already preforms iounmap on some other execution path. 8 | -------------------------------------------------------------------------------- /iom/iom.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing iounmap 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add missing iounmap in error handling code, in a case where the function 7 | already preforms iounmap on some other execution path. 8 | -------------------------------------------------------------------------------- /ioremap2/simplify_ioremap_resource2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /iounmap/ioremap_check.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing iounmap 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | An extra error handling label is needed for the case where the ioremap has 7 | succeeded. 8 | -------------------------------------------------------------------------------- /iserr/patch1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test for IS_ERR rather than 0 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function gfs2_inode_lookup always returns either a valid pointer or a 7 | value made with ERR_PTR, so its result should be tested with IS_ERR, not 8 | with a test for 0. This semantic patch detect candidates for the change. 9 | -------------------------------------------------------------------------------- /iserr/patch2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test for IS_ERR rather than 0 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function ocfs2_start_trans always returns either a valid pointer or a 7 | value made with ERR_PTR, so its result should be tested with IS_ERR, not 8 | with a test for 0. This semantic patch detect candidates for the changes. 9 | -------------------------------------------------------------------------------- /iserr/patch3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test for IS_ERR rather than 0 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function rdma_create_id always returns either a valid pointer or a 7 | value made with ERR_PTR, so its result should be tested with IS_ERR, not 8 | with a test for 0. This semantic patch detect candidates for the change. 9 | -------------------------------------------------------------------------------- /iserr/patch45.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test for IS_ERR rather than 0 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function thermal_cooling_device_register always returns either a valid 7 | pointer or a value made with ERR_PTR, so a test for non-zero on the result 8 | will always succeed. This semantic patch detect candidates for the change. 9 | -------------------------------------------------------------------------------- /iserr_cata/category2a.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct error-handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function returns an ERR_PTR value in an error case instead of NULL. 7 | Thus the test that file is not NULL is always true. 8 | -------------------------------------------------------------------------------- /iserr_ref/iserr_mini.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct an error check 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | rtc is clearly does not satisfy IS_ERR at the point where it is tested, so 7 | I have changed the test to consider the just initialized rtc->rtc_dev. 8 | -------------------------------------------------------------------------------- /iserr_ref/iserr_ref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct an error check 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | rtc is clearly does not satisfy IS_ERR at the point where it is tested, so 7 | I have changed the test to consider the just initialized rtc->rtc_dev. 8 | -------------------------------------------------------------------------------- /iserreq/ise2.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // use PTR_ERR to get error code 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E,E1; 13 | @@ 14 | 15 | *E = IS_ERR(...) 16 | ... when != E = E1 17 | *return E; 18 | -------------------------------------------------------------------------------- /iserreq/ise2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use PTR_ERR to get error code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | IS_ERR returns only 1 or 0. The callsite of setup_regulators expects a 7 | negative integer in an error case. Thus, PTR_ERR has to be used to extract 8 | it. 9 | -------------------------------------------------------------------------------- /itnull/itnull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop unnecessary null test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | list_for_each_entry binds its first argument to a non-null value, and thus 7 | any null test on the value of that argument is superfluous. 8 | -------------------------------------------------------------------------------- /iwcontainer/extra_null.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop unnecessary NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | -------------------------------------------------------------------------------- /jiffies/jiffies.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use time_before, time_before_eq, etc 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The functions time_before, time_before_eq, time_after, and time_after_eq 7 | are more robust for comparing jiffies against other values. 8 | -------------------------------------------------------------------------------- /k-zc-alloc/kzalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Transform some kzalloc calls to kcalloc 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | Transform some kzalloc calls to kcalloc in staging/hv 7 | -------------------------------------------------------------------------------- /kc/kc.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use kzalloc for allocating only one thing 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | @@ 13 | 14 | - kcalloc(1, 15 | + kzalloc( 16 | ...) 17 | -------------------------------------------------------------------------------- /kc/kc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kzalloc for allocating only one thing 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use kzalloc rather than kcalloc(1,...) 7 | -------------------------------------------------------------------------------- /kfree3/kmalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Introduce missing kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Error handling code following a kzalloc should free the allocated data. 7 | -------------------------------------------------------------------------------- /kfree3/kmalloc8a.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Introduce missing kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Error handling code following a kzalloc should free the allocated data. 7 | -------------------------------------------------------------------------------- /kfree_after/kfree_after.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Adjust error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the error handling code at the end of the function, rather than 7 | returning directly. 8 | -------------------------------------------------------------------------------- /kfree_after2/kfree_after.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove unneeded kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The label outnodev is only used when kzalloc has not yet taken place or has 7 | failed, so there is no need for the call for kfree under this label. 8 | -------------------------------------------------------------------------------- /kfree_skb/skbfree.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Convert kfree/kfree_skb to dev_kfree_skb_irq 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | struct sk_buff *skb; 13 | @@ 14 | 15 | - kfree(skb) 16 | + kfree_skb(skb) 17 | -------------------------------------------------------------------------------- /kfrees/kfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Introduce missing kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Introduce missing kfree 7 | -------------------------------------------------------------------------------- /kmalloc9/kmalloc9.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | At this point, ehv_pic has been allocated but not stored anywhere, so it 7 | should be freed before leaving the function. 8 | -------------------------------------------------------------------------------- /kmc1/kmc1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Free kmem_cache_zalloc'd data using kmem_cache_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Memory allocated using kmem_cache_zalloc should be freed using 7 | kmem_cache_free, not kfree. 8 | -------------------------------------------------------------------------------- /kmerr1/kmerr1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /kmerr2/kmerr2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /kmerr3/kmerr3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /kmtest/kmtest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add kmalloc NULL tests 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Check that the result of kmalloc/kzalloc is not NULL before dereferencing it. 7 | -------------------------------------------------------------------------------- /knav/knav.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /kstr/kstr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kstrtoul, etc 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use kstrtoul, etc instead of the now deprecated strict_strtoul, etc. 7 | -------------------------------------------------------------------------------- /kstrdup/kstrdup.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kstrdup 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use kstrdup when the goal of an allocation is copy a string into the 7 | allocated region. 8 | -------------------------------------------------------------------------------- /kzif/kzif.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /label1/label1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /label2/label2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /lcd/category2b_back_device_reg.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Bad error test before a dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | The error test that follows the call to backlight_device_register 8 | seems not to concern the right variable. 9 | -------------------------------------------------------------------------------- /lenull/lenull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop NULL test on list_entry result 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | list_entry, which is an alias for container_of, cannot return NULL, as 7 | there is no way to add a NULL value to a doubly linked list. 8 | -------------------------------------------------------------------------------- /leq/leq.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use ERR_PTR/IS_ERR 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression *E; 13 | @@ 14 | 15 | * E < 0 16 | -------------------------------------------------------------------------------- /leq/leq.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use ERR_PTR/IS_ERR 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use ERR_PTR and IS_ERR rather than mixing integers and pointers. 7 | -------------------------------------------------------------------------------- /list_entry/rcu2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use list_for_each_entry instead of list_for_each 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use list_for_each_entry instead of list_for_each in sound/oss drivers. 7 | -------------------------------------------------------------------------------- /list_entry_update/list_entry_update.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate update of list_for_each_entry loop cursor 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | list_for_each_entry uses its first argument to move from one element to the 7 | next, so modifying it can break the iteration. 8 | -------------------------------------------------------------------------------- /listfree/listfree.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Avoid leaving freed data in a list 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E,E1,E2; 13 | identifier l; 14 | @@ 15 | 16 | *list_add(&E->l,E1); 17 | ... when != E1 18 | when != list_del(&E->l) 19 | when != list_del_init(&E->l) 20 | when != E = E2 21 | *kfree(E); -------------------------------------------------------------------------------- /listfree/listfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Avoid leaving freed data in a list 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The list_for_each_entry loop can fail, in which case the list element is 7 | not removed from the list. Since this list is not accessed by the loop, 8 | the addition of &data->list into the list is just moved after the loop. 9 | -------------------------------------------------------------------------------- /local/local.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add local_irq_restore in error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The gotos to the labels fail_free_irq and fail_unregister only occur 7 | between local_irq_save and local_irq_restore, so it would seem that this 8 | code should also call local_irq_restore. 9 | -------------------------------------------------------------------------------- /lock/o_lock_inconsistent.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Unlock the lock that was locked 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The lock taken was in the ct_ev_lock field, not the hbalock field. 7 | -------------------------------------------------------------------------------- /lustre1/lustre1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /lustre2/lustre2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /lustre2/lustre2a.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /lustre3/recast.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /map_destroy/map_destroy.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // avoid calling map_destroy on NULL 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression *x; 13 | @@ 14 | 15 | *if (x == NULL) 16 | { ... 17 | * map_destroy(x); 18 | ... 19 | return ...; 20 | } -------------------------------------------------------------------------------- /map_destroy/map_destroy.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = avoid calling map_destroy on NULL 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | map_destroy dereferences its argument. The call is furthermore only 7 | reachable when this argument is NULL. Thus the call is dropped. 8 | -------------------------------------------------------------------------------- /markbusy/usb_mark_last_busy.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use usb_mark_last_busy 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | This introduces uses of the function usb_mark_last_busy, define in 7 | include/linux/usb.h. This function only has an effect if 8 | CONFIG_USB_SUSPEND is set. 9 | -------------------------------------------------------------------------------- /mdiobus_unregister/mdiobus_unregister.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Call mdiobus_unregister before mdiobus_free 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Peter Senna Tschudin 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E; 13 | @@ 14 | ... when != mdiobus_unregister(E); 15 | + mdiobus_unregister(E); 16 | mdiobus_free(E); 17 | -------------------------------------------------------------------------------- /mdiobus_unregister/mdiobus_unregister.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Call mdiobus_unregister before mdiobus_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Based on commit b27393aecf66199f5ddad37c302d3e0cfadbe6c0 7 | Calling mdiobus_free without calling mdiobus_unregister causes 8 | BUG_ON(). This patch fixes the issue. 9 | -------------------------------------------------------------------------------- /mem2/mem2.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // drop redundant memset 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e1,e2,e3,e4; 13 | @@ 14 | 15 | - memset(e1,e2,e3); 16 | memcpy(e1,e4,e3); 17 | -------------------------------------------------------------------------------- /mem2/mem2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = drop redundant memset 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The region set by the call to memset is immediately overwritten by the 7 | subsequent call to memcpy. 8 | -------------------------------------------------------------------------------- /memdup/memdup.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kmemdup instead of allocate and memcpy 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use kmemdup when some other buffer is immediately copied into the 7 | allocated region. 8 | -------------------------------------------------------------------------------- /memdup_user/memdup_user.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use memdup_user 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use memdup_user when user data is immediately copied into the 7 | allocated region. 8 | -------------------------------------------------------------------------------- /memuser/memuser.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The label fail frees dev->buf, but kbuf hasn't yet been stored there at 7 | this point. 8 | -------------------------------------------------------------------------------- /memzero/memzero_explicit.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /mesh/mesh.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct the argument to __mesh_table_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In the function mesh_table_grow, it is the new table not the argument table 7 | that should be freed if the function fails (cf commit 8 | bd9b448f4c0a514559bdae4ca18ca3e8cd999c6d) 9 | -------------------------------------------------------------------------------- /mini_lock/mini_lock.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing spin_unlock 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add a spin_unlock missing on the error path. The spin lock is used in a 7 | balanced way elsewhere in the file. 8 | -------------------------------------------------------------------------------- /mini_null/mini_null_ref.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Move a dereference below a NULL test 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | expression E; 14 | identifier i,fld; 15 | statement S; 16 | @@ 17 | 18 | - T i = E->fld; 19 | + T i; 20 | ... when != E 21 | when != i 22 | if (E == NULL) S 23 | + i = E->fld; 24 | -------------------------------------------------------------------------------- /mini_null/mini_null_ref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Move a dereference below a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In each case, if the NULL test is necessary, then the dereference should be 7 | moved below the NULL test. 8 | -------------------------------------------------------------------------------- /mini_null3/mini_null_ref3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Move a dereference below a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | If the NULL test is necessary, then the dereference should be moved below 7 | the NULL test. 8 | -------------------------------------------------------------------------------- /mini_null_check/mini_null_check.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop an unneeded a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In each case, the NULL test is not necessary because the function is static 7 | and at the only places where it is called, the us argument has already been 8 | dereferenced. 9 | -------------------------------------------------------------------------------- /mini_null_check/second_mini_null_check.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop an unneeded a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In each case, the NULL test is not necessary because the function is static 7 | and at the only places where it is called, the us argument has already been 8 | dereferenced. 9 | -------------------------------------------------------------------------------- /mini_null_ref_aug10/mini_null_ref.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Remove potential NULL dereference 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | expression E; 14 | identifier i,fld; 15 | statement S; 16 | @@ 17 | 18 | - T i = E->fld; 19 | + T i; 20 | ... when != E 21 | when != i 22 | if (E == NULL) S 23 | + i = E->fld; 24 | -------------------------------------------------------------------------------- /mini_null_ref_aug10/mini_null_ref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove potential NULL dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | If the NULL test is necessary, the initialization involving a dereference of 7 | the tested value should be moved after the NULL test. 8 | -------------------------------------------------------------------------------- /mini_null_ref_aug14/mini_null_ref.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Remove potential NULL dereferences 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | If the NULL test is necessary, the initialization involving a dereference of 7 | the tested value should be moved after the NULL test. 8 | -------------------------------------------------------------------------------- /misaligned/misaligned.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /misc_undo/send_m1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing snd_card_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function snd_mixart_create creates a link between mgr and card that 7 | allows snd_mixart_free to free card as well. But if snd_mixart_create 8 | fails, then the link has not been created and card has to be freed explicitly. 9 | -------------------------------------------------------------------------------- /misc_undo/send_m2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing snd_card_free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function snd_mixart_create creates a link between mgr and card that 7 | allows snd_mixart_free to free card as well. But if snd_mixart_create 8 | fails, then the link has not been created and card has to be freed explicitly. 9 | -------------------------------------------------------------------------------- /missing_put/missing_put.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | There should be an of_node_put when breaking out of a loop that iterates 7 | using for_each_node_by_type. 8 | -------------------------------------------------------------------------------- /moduleparam/rule5.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Drop redundant includes of moduleparam.h 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @ includesmodule @ 12 | @@ 13 | 14 | #include 15 | 16 | @ depends on includesmodule @ 17 | @@ 18 | 19 | - #include 20 | -------------------------------------------------------------------------------- /moduleparam/rule5.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop redundant includes of moduleparam.h 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Drop #include in files that also include #include 7 | . module.h includes moduleparam.h already. 8 | -------------------------------------------------------------------------------- /more_of_noput/patch.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Of_get_parent and of_find_compatible_node do a of_node_get, and thus a 7 | corresponding of_code_put is needed in both the error case and the normal 8 | return case. 9 | -------------------------------------------------------------------------------- /more_pci/get_slot.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing pci_dev_get 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | pci_get_bus_and_slot does a pci_dev_get, so pci_dev_put needs to be called 7 | in an error case. 8 | -------------------------------------------------------------------------------- /more_pci/more_pci.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing pci_dev_get 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | pci_get_bus_and_slot does a pci_dev_get, so pci_dev_put needs to be called 7 | in an error case. 8 | -------------------------------------------------------------------------------- /mutex/mut.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Release mutex in error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The mutex is released on a successful return, so it would seem that it 7 | should be released on an error return as well. 8 | -------------------------------------------------------------------------------- /mutex2/mutex2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Call mutex_unlock in error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Adjust the error handling code so that it benefits from the call to 7 | mutex_unlock at the end of the function. 8 | -------------------------------------------------------------------------------- /ndp/ndp.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // delete useless tests on netdev_priv 3 | // 4 | // Target: Linux 5 | // Copyright: Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under GPLv2 or any later version. 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | // Target: Linux 12 | 13 | @@ 14 | statement S; 15 | @@ 16 | 17 | - if (!netdev_priv(...)) S 18 | -------------------------------------------------------------------------------- /ndp/ndp.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = delete useless tests on netdev_priv 3 | coccinellery-copyright = Copyright: 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under GPLv2 or any later version. 5 | coccinellery-author0 = Julia Lawall 6 | 7 | Netdev_priv performs an addition, not a pointer dereference, so it seems 8 | quit unlikely that its result would ever be NULL. 9 | 10 | -------------------------------------------------------------------------------- /noderef/noderef.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct size computation 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @expression@ 12 | expression *x; 13 | @@ 14 | 15 | x = 16 | <+... 17 | -sizeof(x) 18 | +sizeof(*x) 19 | ...+> -------------------------------------------------------------------------------- /noderef/noderef.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct size computation 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The size argument to kcalloc should be the size of desired structure, 7 | not the pointer to it. 8 | -------------------------------------------------------------------------------- /noderef2/noderef2.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct size given to memset 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | T *x; 14 | expression E; 15 | @@ 16 | 17 | memset(x, E, sizeof( 18 | + * 19 | x)) -------------------------------------------------------------------------------- /noderef2/noderef2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct size given to memset 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Memset should be given the size of the structure, not the size of the pointer. 7 | -------------------------------------------------------------------------------- /nonet/nonet.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /nopl/nopl.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /noreq/noreq.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /notnull/notnull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Remove redundant test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | vpage is checked not to be NULL just after it is initialized at the 7 | beginning of each loop iteration. 8 | -------------------------------------------------------------------------------- /notnull/notnull2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Correct redundant test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | str has already been tested. It seems that this test should be on the 7 | recently returned value snr. 8 | -------------------------------------------------------------------------------- /null_ref2/mini_null_ref2.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Adjust NULL test 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E,E1; 13 | identifier f,fld,fld1; 14 | statement S1,S2; 15 | @@ 16 | 17 | E->fld = f(...); 18 | ... when != E = E1 19 | when != E->fld1 = E1 20 | if ( 21 | - E 22 | + E->fld 23 | == NULL) S1 else S2 24 | -------------------------------------------------------------------------------- /null_ref2/mini_null_ref2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Since card must already be non-NULL, it seems that what was intended 7 | was to test the result of kmalloc. 8 | -------------------------------------------------------------------------------- /obdalloc/obdalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /obdalloc3/obdalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /obdalloclarge/obdalloclarge.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /obdcpt/obdcptalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /obdfree/obdalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /oddpe/oddpe.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // adjust inconsistent IS_ERR and PTR_ERR 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e,e1; 13 | @@ 14 | 15 | ( 16 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } 17 | | 18 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } 19 | | 20 | *if (IS_ERR(e)) 21 | { ... 22 | * PTR_ERR(e1) 23 | ... } 24 | ) 25 | -------------------------------------------------------------------------------- /oddpe/oddpe.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = adjust inconsistent IS_ERR and PTR_ERR 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Change the call to PTR_ERR to access the value just tested by IS_ERR. 7 | -------------------------------------------------------------------------------- /of_noput/of_noput.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | There should be an of_node_put when breaking out of a loop that iterates 7 | over calls to of_find_all_nodes, as this function does an of_node_get on 8 | the value it returns. 9 | -------------------------------------------------------------------------------- /offset/offset.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use offsetof 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In the patch cc154ac64aa8d3396b187f64cef01ce67f433324, Al Viro observed 7 | that the proper way to compute the distance between two structure fields is 8 | to use offsetof() or a cast to a pointer to character. The same change can 9 | be applied to a few more files. 10 | -------------------------------------------------------------------------------- /ofnametype/ofname1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | of_node_put is needed before discarding a value received from 7 | of_find_node_by_name, eg in error handling code. 8 | -------------------------------------------------------------------------------- /ofnametype/oftype1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | of_node_put is needed before discarding a value received from 7 | of_find_node_by_name, eg in error handling code. 8 | -------------------------------------------------------------------------------- /ofnodeget/ofnodeget.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add of_node_put to avoid memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add a call to of_node_put in the error handling code following a call to 7 | of_find_compatible_node. 8 | -------------------------------------------------------------------------------- /ofnodeget/ofnodeget1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add of_node_put to avoid memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add a call to of_node_put in the error handling code following a call to 7 | of_find_compatible_node. 8 | -------------------------------------------------------------------------------- /ofnodeget/ofnodeget2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add of_node_put to avoid memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Add a call to of_node_put in the error handling code following a call to 7 | of_find_compatible_node. 8 | -------------------------------------------------------------------------------- /ofnodeget3/ofnodeget3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add of_node_put to avoid memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | This function is implemented as though the function of_get_next_child does 7 | not increment the reference count of its result, but actually it does. 8 | Thus the patch adds of_node_put in error handling code and drops a call to 9 | of_node_get. 10 | -------------------------------------------------------------------------------- /ofnodeget4/ofnodeget4.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add of_node_put to avoid memory leak 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In this case, a device_node structure is stored in another structure that 7 | is then freed without first decrementing the reference count of the 8 | device_node structure. 9 | -------------------------------------------------------------------------------- /ofredef/ofredef.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | np is initialized to the result of calling a function that calls 7 | of_node_get, so of_node_put should be called before the pointer is dropped. 8 | -------------------------------------------------------------------------------- /onp/onp.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /orplus2/orplus2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /osdi_isnull/osdi_isnull.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate a NULL pointer dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In each case, the print involves dereferencing a value that is NULL or is 7 | near NULL. 8 | -------------------------------------------------------------------------------- /osdi_isnull/osdi_isnull3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate a NULL pointer dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | In each case, the print involves dereferencing a value that is NULL or is 7 | near NULL. 8 | -------------------------------------------------------------------------------- /osdi_kfree/osdi_kfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate use after free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The error value is saved in a new local variable err before freeing the 7 | containing structure. 8 | -------------------------------------------------------------------------------- /parport/sp8188.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Put gotten port value 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | parport_find_number calls parport_get_port on its result, so there should 7 | be a corresponding call to parport_put_port before dropping the reference. 8 | Similar code is found in the function register_device in the same file. 9 | -------------------------------------------------------------------------------- /parse_phandle/parse_phandle.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Add missing of_node_put 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e,e1,e2; 13 | @@ 14 | 15 | *e = of_parse_phandle(...) 16 | ... when != of_node_put(e) 17 | when != true e == NULL 18 | when != e2 = e 19 | e = e1 -------------------------------------------------------------------------------- /parse_phandle/parse_phandle.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | of_parse_phandle increments the reference count of np, so this should be 7 | decremented before trying the next possibility. 8 | -------------------------------------------------------------------------------- /pci_add_put/pci_noputm.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing pci_dev_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | There should be a pci_dev_put when breaking out of a loop that iterates 7 | over calls to pci_get_device and similar functions. 8 | -------------------------------------------------------------------------------- /pci_drop_put/pci_get.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop unnecessary pci_dev_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Remove an unnecessary pci_dev_put. pci_dev_put is called implicitly by the 7 | subsequent call to pci_get_device. 8 | -------------------------------------------------------------------------------- /pcicst/pcicst.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /pciom/pciom3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Exchange pci_iounmaps 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The calls to pci_iounmap are in the wrong order, as compared to the 7 | associated calls to pci_iomap. 8 | -------------------------------------------------------------------------------- /pcipower/pcipower.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /pcr/pcr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /pd/pd.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Invert calls to platform_device_put and platform_device_del 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression e1,e2; 13 | @@ 14 | 15 | *platform_device_put(e1); 16 | ... when != e1 = e2 17 | *platform_device_del(e1); -------------------------------------------------------------------------------- /pd/pd.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Invert calls to platform_device_put and platform_device_del 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Platform_device_del should be called before platform_device_put, as 7 | platform_device_put can delete the structure. 8 | Additionally, improve the error handling code for the call to ioremap, so 9 | that it calls platform_device_put. 10 | -------------------------------------------------------------------------------- /pfc0/pfc0.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /platret/platret.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // failure test for null rather than negative integer 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x,e; 13 | statement S1,S2; 14 | @@ 15 | 16 | *x = dev_get_platdata(...) 17 | ... when != x = e 18 | *if (x < 0) S1 else S2 -------------------------------------------------------------------------------- /platret/platret.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = failure test for null rather than negative integer 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | dev_get_platdata returns a pointer, so the failure value would be NULL 7 | rather than a negative integer. 8 | -------------------------------------------------------------------------------- /pointless_err/pointless_err.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use ERR_CAST 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | T x; 14 | identifier f; 15 | @@ 16 | 17 | T f (...) { <+... 18 | - ERR_PTR(PTR_ERR(x)) 19 | + x 20 | ...+> } 21 | 22 | @@ 23 | expression x; 24 | @@ 25 | 26 | - ERR_PTR(PTR_ERR(x)) 27 | + ERR_CAST(x) 28 | -------------------------------------------------------------------------------- /pointless_err/pointless_err.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use ERR_CAST 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)). The former makes more 7 | clear what is the purpose of the operation, which otherwise looks like a 8 | no-op. 9 | -------------------------------------------------------------------------------- /prepare2/prepare2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use clk_prepare_enable and clk_disable_unprepare 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and 7 | clk_enable, and clk_disable and clk_unprepare. They make the code more 8 | concise, and ensure that clk_unprepare is called when clk_enable fails. 9 | -------------------------------------------------------------------------------- /ptr/ptr.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Correct error handling code 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E,E1; 13 | @@ 14 | 15 | if ( 16 | - E == NULL 17 | + IS_ERR(E) 18 | ) { <+... when != E = E1 19 | PTR_ERR(E) 20 | ...+> } 21 | -------------------------------------------------------------------------------- /ptr/ptr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct error handling code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | If it is reasonable to apply PTR_ERR to the result of calling clk_get, then 7 | that result should first be tested with IS_ERR, not with !. 8 | -------------------------------------------------------------------------------- /ptrerr/ptrerr.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /put_after/put_after.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | dma_channel_np has been accessed at this point, so decrease its reference 7 | count before leaving the function. 8 | -------------------------------------------------------------------------------- /put_deref/patch.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Move of_node_put 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @r exists@ 12 | expression n,E; 13 | identifier fld; 14 | iterator I; 15 | statement S; 16 | @@ 17 | 18 | * of_node_put(n) 19 | ... when != n = E 20 | when != I(n,...) S 21 | * n->fld 22 | -------------------------------------------------------------------------------- /put_deref/patch.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Move of_node_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | It seems better to dereference master before decrementing the reference 7 | count rather than afterwards. 8 | -------------------------------------------------------------------------------- /putty/putty.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Avoid calling put_tty_driver on NULL 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression *x; 13 | @@ 14 | 15 | *if (x == NULL) 16 | { ... 17 | * put_tty_driver(x); 18 | ... 19 | return ...; 20 | } -------------------------------------------------------------------------------- /rcu/rcu.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Call rcu_read_unlock in default case 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @rcu@ 12 | position p1; 13 | @@ 14 | 15 | rcu_read_lock@p1(); 16 | ... 17 | rcu_read_unlock(); 18 | 19 | @@ 20 | position rcu.p1; 21 | @@ 22 | 23 | *rcu_read_lock@p1(); 24 | ... when != rcu_read_unlock(); 25 | -------------------------------------------------------------------------------- /rcu/rcu.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Call rcu_read_unlock in default case 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Adjust the default case so that it benefits from the call to rcu_read_unlock. 7 | -------------------------------------------------------------------------------- /reiserfs/category2a_open_xa_dir.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use an IS_ERR test rather than a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | In case of error, the function open_xa_dir returns an ERR pointer, 8 | but never returns a NULL pointer. So a NULL test that comes after an 9 | IS_ERR test should be deleted. 10 | -------------------------------------------------------------------------------- /removed/removed.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /reqrel2/reqrel2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use release_mem_region after request_mem_region 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The memory allocated using request_mem_region should be released using 7 | release_mem_region, not release_region. 8 | -------------------------------------------------------------------------------- /requests/diou.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // use devm_kzalloc and devm_clk_get 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression x; 13 | @@ 14 | 15 | *x = devm_ioremap(...) 16 | ... 17 | iounmap(x); -------------------------------------------------------------------------------- /requests/diou.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use devm_kzalloc and devm_clk_get 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Using devm_kzalloc and devm_clk_get simplifies the code and ensures that 7 | the use of devm_request_irq is safe. When kzalloc and kfree were used, the 8 | interrupt could be triggered after the handler's data argument had been 9 | freed. 10 | -------------------------------------------------------------------------------- /requests/dirq.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = use devm_kzalloc and devm_clk_get 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Using devm_kzalloc and devm_clk_get simplifies the code and ensures that 7 | the use of devm_request_irq is safe. When kzalloc and kfree were used, the 8 | interrupt could be triggered after the handler's data argument had been 9 | freed. 10 | -------------------------------------------------------------------------------- /resource_fix1/resource_fix1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Convert release_resource to release_mem_region 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Request_mem_region should be used with release_mem_region, not 7 | release_resource. 8 | -------------------------------------------------------------------------------- /resource_size/resource_size.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use resource_size 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the function resource_size, which reduces the chance of introducing 7 | off-by-one errors in calculating the resource size. 8 | -------------------------------------------------------------------------------- /ret0/ret0.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /ret3/ret3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Fix error return code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert a nonnegative error return code to a negative one, as returned 7 | elsewhere in the function. 8 | -------------------------------------------------------------------------------- /ret4/ret4.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Fix error return code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Initialize return variable before exiting on an error path. 7 | -------------------------------------------------------------------------------- /ret6/ret6.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /retalloc/retalloc.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Fix error return code 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert a 0 error return code to a negative one, as returned elsewhere in the 7 | function. 8 | -------------------------------------------------------------------------------- /retest/retest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust duplicate test 3 | coccinellery-copyright = Copyright: 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Delete successive tests to the same location. In this case intc_node has 7 | already been tested for being NULL, and calling of_find_node_by_name will 8 | not make it NULL. On the other hand, of_find_node_by_name can return NULL 9 | on failure. 10 | -------------------------------------------------------------------------------- /rirqp/rirqp.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Ensure arguments to request_irq and free_irq are compatible 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Convert calls to free_irq so that the second argument is the same as the 7 | last argument of the corresponding call to request_irq. Without this 8 | property, free_irq does nothing. 9 | -------------------------------------------------------------------------------- /round/round.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use DIV_ROUND_UP 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / 7 | (d)) but is perhaps more readable. 8 | -------------------------------------------------------------------------------- /round2/round.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use DIV_ROUND_UP 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / 7 | (d)) but is perhaps more readable. 8 | -------------------------------------------------------------------------------- /round_closest/round_closest.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use DIV_ROUND_CLOSEST 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @haskernel@ 12 | @@ 13 | 14 | #include 15 | 16 | @depends on haskernel@ 17 | expression x,__divisor; 18 | @@ 19 | 20 | - (((x) + ((__divisor) / 2)) / (__divisor)) 21 | + DIV_ROUND_CLOSEST(x,__divisor) -------------------------------------------------------------------------------- /round_closest/round_closest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use DIV_ROUND_CLOSEST 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d 7 | but is perhaps more readable. 8 | -------------------------------------------------------------------------------- /semicolon/semicolon.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Remove unnecessary semicolon 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Removes unnecessary semicolon 7 | -------------------------------------------------------------------------------- /serial_core/serial_core.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use UPIO_MEM rather than SERIAL_IO_MEM 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | As in the commit 9b4a1617772d6d5ab5eeda0cd95302fae119e359, use UPIO_MEM 7 | rather than SERIAL_IO_MEM. Both have the same value. 8 | -------------------------------------------------------------------------------- /setup_timer/setup_timer.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /signed/signed.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Use unsigned for loop index 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | A few more cases in the spirit of the patch \"Trivial: Replacement of always 7 | >0 ints with unsigned ints\" submitted by Ricardo Martins 8 | -------------------------------------------------------------------------------- /simple_kzalloc/simple_kzalloc1.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use kzalloc instead of kmalloc and memset 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use kzalloc rather than the combination of kmalloc and memset. 7 | -------------------------------------------------------------------------------- /simplify_ioremap_resource/simplify_ioremap_resource.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /simplify_ioremap_resource/simplify_ioremap_resource2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /sin_family/sin_family.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use AF_INET for sin_family field 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Elsewhere the sin_family field holds a value with a name of the form 7 | AF_..., so it seems reasonable to do so here as well. Also the values of 8 | PF_INET and AF_INET are the same. 9 | -------------------------------------------------------------------------------- /sizeof/sizeof_sizeof.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Eliminate double sizeof 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E; 13 | @@ 14 | 15 | - sizeof ( 16 | sizeof (E) 17 | - ) 18 | 19 | @@ 20 | type T; 21 | @@ 22 | 23 | - sizeof ( 24 | sizeof (T) 25 | - ) 26 | -------------------------------------------------------------------------------- /sizeof/sizeof_sizeof.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Eliminate double sizeof 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Taking sizeof the result of sizeof is quite strange and does not seem to be 7 | what is wanted here. 8 | -------------------------------------------------------------------------------- /sizeof_notype/sizeof_notype.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /sla/sla.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use GFP_ATOMIC when a lock is held 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | @@ 13 | 14 | spin_lock(...) 15 | ... when != spin_unlock(...) 16 | -GFP_KERNEL 17 | +GFP_ATOMIC -------------------------------------------------------------------------------- /sla/sla.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use GFP_ATOMIC when a lock is held 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | A spin lock is taken near the beginning of the enclosing function. 7 | -------------------------------------------------------------------------------- /slot/slot.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Add missing pci_dev_put 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Pci_get_slot calls pci_dev_get, so pci_dev_put is needed before leaving the 7 | function. 8 | -------------------------------------------------------------------------------- /sockfd/patch.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use sockfd_put 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression s; 13 | @@ 14 | 15 | s = sockfd_lookup(...) 16 | ... 17 | + sockfd_put(s); 18 | ?- fput(s->file); 19 | -------------------------------------------------------------------------------- /static2/static2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /stest/stest.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Put NULL test before dereference 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @r@ 12 | expression E1,E2; 13 | identifier fld; 14 | statement S1,S2; 15 | @@ 16 | 17 | E1 = E2->fld; 18 | ( 19 | if (E1 == NULL) S1 else S2 20 | | 21 | *if (E2 == NULL) S1 else S2 22 | ) 23 | -------------------------------------------------------------------------------- /stest/stest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Put NULL test before dereference 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | If the NULL test on block is needed, it should be before the dereference of 7 | the base field. 8 | -------------------------------------------------------------------------------- /strsize/strsizeof.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Convert strncmp to strcmp 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression foo; 13 | constant char *abc; 14 | @@ 15 | 16 | strncmp(foo, abc, 17 | - sizeof(abc) 18 | + sizeof(abc)-1 19 | ) 20 | -------------------------------------------------------------------------------- /strsize/strsizeof.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Convert strncmp to strcmp 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | As an identical match is wanted in this case, strcmp can be used instead. 7 | -------------------------------------------------------------------------------- /strtoul/simple.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Change simple_strtol to simple_strtoul 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Since bridge is unsigned, it would seem better to use simple_strtoul that 7 | simple_strtol. 8 | -------------------------------------------------------------------------------- /sz/sz.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Correct code taking the size of a pointer 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | sizeof(share_id) is just the size of the pointer. On the other hand, 7 | block->share_id is an array, so its size seems more appropriate. 8 | -------------------------------------------------------------------------------- /sz3/sz3.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Take size of pointed value, not pointer 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Sizeof a pointer-typed expression returns the size of the pointer, not that 7 | of the pointed data. 8 | -------------------------------------------------------------------------------- /targets: -------------------------------------------------------------------------------- 1 | Generic 2 | Linux 3 | Firehose 4 | -------------------------------------------------------------------------------- /testeno/testeno.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // correct error check 3 | // 4 | // Target: Linux 5 | // Copyright: Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under GPLv2 or any later version. 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | // Target: Linux 12 | 13 | @@ 14 | expression *x; 15 | identifier f; 16 | statement S1,S2; 17 | @@ 18 | 19 | *x = f(...); 20 | if (x) { <+... when != if (...) S1 else S2 21 | -ENOMEM ...+> } -------------------------------------------------------------------------------- /testeno/testeno.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = correct error check 3 | coccinellery-copyright = Copyright: 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under GPLv2 or any later version. 5 | coccinellery-author0 = Julia Lawall 6 | 7 | iio_kfifo_allocate returns NULL in case of error. 8 | 9 | -------------------------------------------------------------------------------- /tinit/tinit.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /tipc/tipc.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use tipc_port_unlock 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | struct port *p_ptr; 13 | @@ 14 | 15 | p_ptr = tipc_port_lock(...) 16 | ... 17 | ( 18 | p_ptr = tipc_port_lock(...); 19 | | 20 | ?- spin_unlock_bh(p_ptr->publ.lock); 21 | + tipc_port_unlock(p_ptr); 22 | ) -------------------------------------------------------------------------------- /tty_port/sp10730.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Put correct tty value 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The tty value that should be put is the one that was just gotten by 7 | tty_port_tty_get, not the one that is the argument to the enclosing 8 | function. 9 | -------------------------------------------------------------------------------- /typedef/handle.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Transform typedef HANDLE into void * 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Nicolas Palix 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @rem_handle@ 12 | @@ 13 | -typedef void* HANDLE; 14 | 15 | @fix_handle@ 16 | typedef HANDLE; 17 | @@ 18 | -HANDLE 19 | +void* 20 | 21 | @fix_sizeof_handle@ 22 | @@ 23 | -sizeof(HANDLE) 24 | +sizeof(void*) 25 | -------------------------------------------------------------------------------- /typedef/handle.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Transform typedef HANDLE into void * 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | Remove typedef HANDLE which aliases a void pointer and use void * 7 | anywhere HANDLE was used. 8 | -------------------------------------------------------------------------------- /typedef/hv/device_object/DEVICE_OBJECT.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | Remove typedef DEVICE_OBJECT and use a struct named hv_device instead. 7 | Remove typedef PDEVICE_OBJECT which aliases a pointer and use the 8 | struct pointer (struct hv_device *). 9 | -------------------------------------------------------------------------------- /typedef/hv/driver_object/DRIVER_OBJECT.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove typedef DRIVER_OBJECT and PDRIVER_OBJECT 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | typedef DRIVER_OBJECT and PDRIVER_OBJECT are removed and their usages 7 | are replace by the use of struct hv_driver and struct hv_driver * 8 | respectively. 9 | -------------------------------------------------------------------------------- /typedef/hv/netvsc/NETVSC_PACKET.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove typedef NETVSC_PACKET and PNETVSC_PACKET 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | typedef NETVSC_PACKET and PNETVSC_PACKET are removed and their usages 7 | are replace by the use of struct hv_netvsc_packet and 8 | struct hv_netvsc_packet * respectively. 9 | -------------------------------------------------------------------------------- /typedef/hv/storvsc/STORVSC_REQUEST.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove typedef STORVSC_REQUEST and PSTORVSC_REQUEST 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Nicolas Palix 6 | typedef STORVSC_REQUEST and PSTORVSC_REQUEST are removed and their 7 | usages are replace by the use of struct hv_storvsc_request and 8 | struct hv_storvsc_request * respectively. 9 | -------------------------------------------------------------------------------- /ubifs/category2a_kthread_create.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use an IS_ERR test rather than a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | In case of error, the function kthread_create returns an ERR pointer, 8 | but never returns a NULL pointer. So a NULL test that comes before an 9 | IS_ERR test should be deleted. 10 | -------------------------------------------------------------------------------- /ulfe/ulfe.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Use list_for_each_entry 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | struct list_head *pos; 13 | struct list_head *head; 14 | statement S; 15 | @@ 16 | 17 | *for (pos = (head)->next; pos != (head); pos = pos->next) 18 | S -------------------------------------------------------------------------------- /ulfe/ulfe.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use list_for_each_entry 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use list_for_each_entry and perform some other induced simplifications. 7 | -------------------------------------------------------------------------------- /unarray/unarray.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /undevm/undevm.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Kfree etc should not be used with devm functions 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Using kfree with devm_kzalloc will cause a double free, and likewise for 7 | the other devm functions. 8 | -------------------------------------------------------------------------------- /unsf/unsf.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Fix return value from an unsigned function 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | The function has an unsigned return type, but returns a negative constant 7 | to indicate an error condition. 8 | -------------------------------------------------------------------------------- /unused/unused.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Remove unused variable 3 | // 4 | // Target: Linux 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | type T; 13 | identifier i; 14 | constant C; 15 | @@ 16 | 17 | ( 18 | extern T i; 19 | | 20 | - T i; 21 | <+... when != i 22 | - i = C; 23 | ...+> 24 | ) 25 | -------------------------------------------------------------------------------- /unused/unused.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove unused variable 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Remove unused variable 7 | -------------------------------------------------------------------------------- /unused_err/unused_err.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Use available error codes 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Error codes are stored in err, but the return value is always 0. Return 7 | err instead. 8 | -------------------------------------------------------------------------------- /unused_var_kfree/unused_var_kfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove unused variables and useless calls to kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | old_class_name, and new_class_name are never used. This patch remove the 7 | declaration and calls to kfree. 8 | -------------------------------------------------------------------------------- /urb2/urb2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Delete unnecessary call to usb_kill_urb 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Since in each case nothing has been done with the recently allocated urb, 7 | it is not necessary to kill it before freeing it. 8 | -------------------------------------------------------------------------------- /urb8/urb8.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Introduce missing usb_free_urb 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Error handling code following a usb_alloc_urb should free the allocated data. 7 | -------------------------------------------------------------------------------- /usbdata/usb_get_intfdata.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use usb_set/get_intfdata 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the USB functions usb_get_intfdata and usb_set_intfdata instead of 7 | dev_get_drvdata and dev_set_drvdata, respectively. 8 | -------------------------------------------------------------------------------- /usbdata/usb_set_intfdata.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use usb_set/get_intfdata 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the USB functions usb_get_intfdata and usb_set_intfdata instead of 7 | dev_get_drvdata and dev_set_drvdata, respectively. 8 | -------------------------------------------------------------------------------- /usbdir/end.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use usb_endpoint_dir_out 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use the usb_endpoint_dir_out API function. Note that the use of 7 | USB_TYPE_MASK in the original code is incorrect; it results in a test that 8 | is always false. 9 | -------------------------------------------------------------------------------- /use_freed_specific/bad_kfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Eliminate use after free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | __sa1111_remove always frees its argument, so the subsequent reference to 7 | sachip->saved_state represents a use after free. __sa1111_remove does not 8 | appear to use the saved_state field, so the patch simply frees it first. 9 | -------------------------------------------------------------------------------- /usefreed/bad_kfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Correct use after free 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Move the kfree after a reference to the freed structure. 7 | -------------------------------------------------------------------------------- /useless2/useless2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /uselesskfree/uselesskfree.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Remove useless kfree 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Remove useless kfree() and clean up code related to the removal. 7 | -------------------------------------------------------------------------------- /usnic/usnic.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /videobuf_dvb_get_frontend_return_null/videobuf_dvb_get_frontend_return_null.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test if videobuf_dvb_get_frontend return NULL 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Peter Senna Tschudin 6 | Based on commit: e66131cee501ee720b7b58a4b87073b8fbaaaba6 7 | Not testing videobuf_dvb_get_frontend output may cause OOPS if it return 8 | NULL. This patch fixes this issue. 9 | -------------------------------------------------------------------------------- /warn/warn.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use WARN 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Use WARN rather than printk followed by WARN_ON(1), for conciseness. 7 | -------------------------------------------------------------------------------- /warn2/warn2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Drop if around WARN_ON 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Just use WARN_ON rather than an if containing only WARN_ON(1). 7 | -------------------------------------------------------------------------------- /write2/write2.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = delete double assignment 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Delete successive assignments to the same location. 7 | -------------------------------------------------------------------------------- /wrongcheck/wrongcheck.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Not available\ncoccinellery-short = Not available\ncoccinellery-copyright = Copyright: 2012 - LIP6/INRIA\ncoccinellery-license = Licensed under GPLv2 or any later version.\ncoccinellery-author0 = Not available\n\nNot available\n 2 | -------------------------------------------------------------------------------- /wrongtest/wrongtest.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Test the just-initialized value 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Test the just-initialized value rather than some other one. 7 | -------------------------------------------------------------------------------- /xand/xand.cocci: -------------------------------------------------------------------------------- 1 | // 2 | // Detect duplicated test 3 | // 4 | // Target: Linux, Generic 5 | // Copyright: 2012 - LIP6/INRIA 6 | // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license 7 | // Author: Julia Lawall 8 | // URL: http://coccinelle.lip6.fr/ 9 | // URL: http://coccinellery.org/ 10 | 11 | @@ 12 | expression E; 13 | @@ 14 | 15 | ( 16 | *E && E 17 | | 18 | *E || E 19 | ) 20 | -------------------------------------------------------------------------------- /xand/xand.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux, Generic 2 | coccinellery-short = Detect duplicated test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | Look for duplicate && and || tests. 7 | -------------------------------------------------------------------------------- /xfrm/category2a_xfrm_bundle_create.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Use an IS_ERR test rather than a NULL test 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julien Brunel 6 | coccinellery-author1 = Julia Lawall 7 | In case of error, the function xfrm_bundle_create returns an ERR 8 | pointer, but never returns a NULL pointer. So a NULL test that comes 9 | after an IS_ERR test should be deleted. 10 | -------------------------------------------------------------------------------- /zercst/zercst.desc: -------------------------------------------------------------------------------- 1 | coccinellery-target = Linux 2 | coccinellery-short = Adjust suspicious bit operation 3 | coccinellery-copyright = 2012 - LIP6/INRIA 4 | coccinellery-license = Licensed under ISC. See LICENSE or http://www.isc.org/software/license 5 | coccinellery-author0 = Julia Lawall 6 | IRQF_TRIGGER_HIGH is 0x00000004, so it seems that & was intended rather than |. 7 | --------------------------------------------------------------------------------