kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [help][coccinelle] coccicheck failed
@ 2020-06-18 13:23 Giacomo Picchiarelli
  2020-06-18 15:07 ` Randy Dunlap
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Giacomo Picchiarelli @ 2020-06-18 13:23 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

Newbie here. I couldn't try the patch attached. 
I'm using coccinelle (spatch version 1.0.4 with Python support and with PCRE support), 
I'm having issues with the following command:

make coccicheck MODE=patch

"./tools/testing/selftests/net/hwtstamp_config.c:74:45-46: WARNING: Use ARRAY_SIZE

807 811

coccicheck failed"

Applied to: commit 1b5044021070efa3259f3e9548dc35d1eb6aa844 (HEAD -> master, origin/master, origin/HEAD)
Merge: 69119673bd50 dbed452a078d
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed Jun 17 11:29:37 2020 -0700

Suggestions?

-- 
Giacomo Picchiarelli <gpicchiarelli@gmail.com>
GPG Key: 2E51 2591 F3E8 7CDC F504  140F 8559 3ACF 4691 ACC0


[-- Attachment #2: coccinelle_patch.txt --]
[-- Type: text/plain, Size: 12865 bytes --]


Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.

diff -u -p a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c
@@ -890,7 +890,7 @@ static int init_powerplay_table_informat
 				power_saving_clock_count);
 	}
 
-	pptable_information->smc_pptable = (PPTable_t *)kmalloc(sizeof(PPTable_t), GFP_KERNEL);
+	pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL);
 	if (pptable_information->smc_pptable == NULL)
 		return -ENOMEM;
 
diff -u -p a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -2593,7 +2593,7 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, u
        /* Get the data transfer speeds
         */
 	data_sz = ioc->spi_data.sdp0length * 4;
-	pg0_alloc = (SCSIDevicePage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
+	pg0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
 	if (pg0_alloc) {
 		hdr.PageVersion = ioc->spi_data.sdp0version;
 		hdr.PageLength = data_sz;
@@ -2657,7 +2657,7 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, u
 		/* Issue the second config page request */
 		cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
 		data_sz = (int) cfg.cfghdr.hdr->PageLength * 4;
-		pg3_alloc = (SCSIDevicePage3_t *) pci_alloc_consistent(
+		pg3_alloc = pci_alloc_consistent(
 							ioc->pcidev, data_sz, &page_dma);
 		if (pg3_alloc) {
 			cfg.physAddr = page_dma;
diff -u -p a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c
--- a/drivers/nfc/st-nci/se.c
+++ b/drivers/nfc/st-nci/se.c
@@ -331,7 +331,7 @@ static int st_nci_hci_connectivity_event
 		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
 			return -EPROTO;
 
-		transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
+		transaction = devm_kzalloc(dev,
 					    skb->len - 2, GFP_KERNEL);
 		if (!transaction)
 			return -ENOMEM;
diff -u -p a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
@@ -1175,7 +1175,6 @@ qed_rdma_destroy_cq(void *rdma_cxt,
 	DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", in_params->icid);
 
 	p_ramrod_res =
-	    (struct rdma_destroy_cq_output_params *)
 	    dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
 			       sizeof(struct rdma_destroy_cq_output_params),
 			       &ramrod_res_phys, GFP_KERNEL);
diff -u -p a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -1152,7 +1152,7 @@ octeon_register_dispatch_fn(struct octeo
 
 		dev_dbg(&oct->pci_dev->dev,
 			"Adding opcode to dispatch list linked list\n");
-		dispatch = (struct octeon_dispatch *)
+		dispatch =
 			   vmalloc(sizeof(struct octeon_dispatch));
 		if (!dispatch) {
 			dev_err(&oct->pci_dev->dev,
diff -u -p a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1024,7 +1024,7 @@ static int hix5hd2_init_sg_desc_queue(st
 	struct sg_desc *desc;
 	dma_addr_t phys_addr;
 
-	desc = (struct sg_desc *)dma_alloc_coherent(priv->dev,
+	desc = dma_alloc_coherent(priv->dev,
 				TX_DESC_NUM * sizeof(struct sg_desc),
 				&phys_addr, GFP_KERNEL);
 	if (!desc)
diff -u -p a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -2952,7 +2952,7 @@ static int gem_init_one(struct pci_dev *
 	/* It is guaranteed that the returned buffer will be at least
 	 * PAGE_SIZE aligned.
 	 */
-	gp->init_block = (struct gem_init_block *)
+	gp->init_block =
 		pci_alloc_consistent(pdev, sizeof(struct gem_init_block),
 				     &gp->gblock_dvma);
 	if (!gp->init_block) {
diff -u -p a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -58,7 +58,7 @@ int fnic_debugfs_init(void)
 						fnic_trace_debugfs_root);
 
 	/* Allocate memory to structure */
-	fc_trc_flag = (struct fc_trace_flag_type *)
+	fc_trc_flag =
 		vmalloc(sizeof(struct fc_trace_flag_type));
 
 	if (fc_trc_flag) {
diff -u -p a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_processpptables.c
@@ -252,7 +252,7 @@ static int init_powerplay_table_informat
 	phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_max, powerplay_table->PowerSavingClockMax, ATOM_VEGA12_PPCLOCK_COUNT);
 	phm_copy_clock_limits_array(hwmgr, &pptable_information->power_saving_clock_min, powerplay_table->PowerSavingClockMin, ATOM_VEGA12_PPCLOCK_COUNT);
 
-	pptable_information->smc_pptable = (PPTable_t *)kmalloc(sizeof(PPTable_t), GFP_KERNEL);
+	pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL);
 	if (pptable_information->smc_pptable == NULL)
 		return -ENOMEM;
 
diff -u -p a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -822,7 +822,7 @@ static int qed_roce_sp_destroy_qp_reques
 	if (!qp->req_offloaded)
 		return 0;
 
-	p_ramrod_res = (struct roce_destroy_qp_req_output_params *)
+	p_ramrod_res =
 		       dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
 					  sizeof(*p_ramrod_res),
 					  &ramrod_res_phys, GFP_KERNEL);
diff -u -p a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -717,7 +717,7 @@ static int map_sg_data(struct scsi_cmnd
 
 	/* get indirect table */
 	if (!evt_struct->ext_list) {
-		evt_struct->ext_list = (struct srp_direct_buf *)
+		evt_struct->ext_list =
 			dma_alloc_coherent(dev,
 					   SG_ALL * sizeof(struct srp_direct_buf),
 					   &evt_struct->ext_list_token, 0);
diff -u -p a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2298,7 +2298,7 @@ struct iw_cm_conn_param;
 				      struct ib_struct)))
 
 #define rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, gfp)                         \
-	((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, gfp))
+	(kzalloc(ib_dev->ops.size_##ib_type, gfp))
 
 #define rdma_zalloc_drv_obj(ib_dev, ib_type)                                   \
 	rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, GFP_KERNEL)
diff -u -p a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -4976,7 +4976,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
 
 	if (hdr.PageLength > 0) {
 		data_sz = hdr.PageLength * 4;
-		ppage0_alloc = (LANPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
+		ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
 		rc = -ENOMEM;
 		if (ppage0_alloc) {
 			memset((u8 *)ppage0_alloc, 0, data_sz);
@@ -5022,7 +5022,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
 
 	data_sz = hdr.PageLength * 4;
 	rc = -ENOMEM;
-	ppage1_alloc = (LANPage1_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page1_dma);
+	ppage1_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page1_dma);
 	if (ppage1_alloc) {
 		memset((u8 *)ppage1_alloc, 0, data_sz);
 		cfg.physAddr = page1_dma;
@@ -5323,7 +5323,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
 	/* Read the config page */
 	data_sz = hdr.PageLength * 4;
 	rc = -ENOMEM;
-	ppage_alloc = (IOUnitPage2_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
+	ppage_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
 	if (ppage_alloc) {
 		memset((u8 *)ppage_alloc, 0, data_sz);
 		cfg.physAddr = page_dma;
diff -u -p a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
--- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
@@ -280,11 +280,11 @@ int octeon_init_droq(struct octeon_devic
 	dev_dbg(&oct->pci_dev->dev, "droq[%d]: num_desc: %d\n", q_no,
 		droq->max_count);
 
-	droq->recv_buf_list = (struct octeon_recv_buffer *)
+	droq->recv_buf_list =
 	      vzalloc_node(array_size(droq->max_count, OCT_DROQ_RECVBUF_SIZE),
 			   numa_node);
 	if (!droq->recv_buf_list)
-		droq->recv_buf_list = (struct octeon_recv_buffer *)
+		droq->recv_buf_list =
 		      vzalloc(array_size(droq->max_count,
 					 OCT_DROQ_RECVBUF_SIZE));
 	if (!droq->recv_buf_list) {
diff -u -p a/drivers/crypto/cavium/cpt/cptvf_main.c b/drivers/crypto/cavium/cpt/cptvf_main.c
--- a/drivers/crypto/cavium/cpt/cptvf_main.c
+++ b/drivers/crypto/cavium/cpt/cptvf_main.c
@@ -233,7 +233,7 @@ static int alloc_command_queues(struct c
 
 			c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes :
 					rem_q_size;
-			curr->head = (u8 *)dma_alloc_coherent(&pdev->dev,
+			curr->head = dma_alloc_coherent(&pdev->dev,
 							      c_size + CPT_NEXT_CHUNK_PTR_SIZE,
 							      &curr->dma_addr,
 							      GFP_KERNEL);
diff -u -p a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -763,7 +763,7 @@ mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, i
 
 	data_sz = hdr.PageLength * 4;
 	rc = -ENOMEM;
-	ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
+	ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
 	if (ppage0_alloc) {
 
  try_again:
@@ -904,7 +904,7 @@ start_over:
 		if (data_sz < sizeof(FCPortPage1_t))
 			data_sz = sizeof(FCPortPage1_t);
 
-		page1_alloc = (FCPortPage1_t *) pci_alloc_consistent(ioc->pcidev,
+		page1_alloc = pci_alloc_consistent(ioc->pcidev,
 						data_sz,
 						&page1_dma);
 		if (!page1_alloc)
diff -u -p a/drivers/nfc/st21nfca/se.c b/drivers/nfc/st21nfca/se.c
--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -315,7 +315,7 @@ int st21nfca_connectivity_event_received
 		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
 			return -EPROTO;
 
-		transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
+		transaction = devm_kzalloc(dev,
 						   skb->len - 2, GFP_KERNEL);
 		if (!transaction)
 			return -ENOMEM;
diff -u -p a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -1548,7 +1548,7 @@ static int allocate_fw_buffers(struct es
 
 	a->firmware.orig_len = length;
 
-	a->firmware.data = (u8 *)dma_alloc_coherent(&a->pcid->dev,
+	a->firmware.data = dma_alloc_coherent(&a->pcid->dev,
 						    (size_t)length,
 						    (dma_addr_t *)&a->firmware.
 						    phys,
@@ -1895,7 +1895,7 @@ int esas2r_write_vda(struct esas2r_adapt
 
 	if (!a->vda_buffer) {
 		dma_addr_t dma_addr;
-		a->vda_buffer = (u8 *)dma_alloc_coherent(&a->pcid->dev,
+		a->vda_buffer = dma_alloc_coherent(&a->pcid->dev,
 							 (size_t)
 							 VDA_MAX_BUFFER_SIZE,
 							 &dma_addr,
@@ -2064,7 +2064,7 @@ int esas2r_write_fs(struct esas2r_adapte
 re_allocate_buffer:
 			a->fs_api_buffer_size = length;
 
-			a->fs_api_buffer = (u8 *)dma_alloc_coherent(
+			a->fs_api_buffer = dma_alloc_coherent(
 				&a->pcid->dev,
 				(size_t)a->fs_api_buffer_size,
 				(dma_addr_t *)&a->ppfs_api_buffer,
diff -u -p a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -223,7 +223,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
 struct inode *v9fs_alloc_inode(struct super_block *sb)
 {
 	struct v9fs_inode *v9inode;
-	v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache,
+	v9inode = kmem_cache_alloc(v9fs_inode_cache,
 							GFP_KERNEL);
 	if (!v9inode)
 		return NULL;
diff -u -p a/drivers/s390/crypto/zcrypt_ep11misc.c b/drivers/s390/crypto/zcrypt_ep11misc.c
--- a/drivers/s390/crypto/zcrypt_ep11misc.c
+++ b/drivers/s390/crypto/zcrypt_ep11misc.c
@@ -195,11 +195,10 @@ static inline struct ep11_cprb *alloc_cp
 	size_t len = sizeof(struct ep11_cprb) + payload_len;
 	struct ep11_cprb *cprb;
 
-	cprb = kmalloc(len, GFP_KERNEL);
+	cprb = kzalloc(len, GFP_KERNEL);
 	if (!cprb)
 		return NULL;
 
-	memset(cprb, 0, len);
 	cprb->cprb_len = sizeof(struct ep11_cprb);
 	cprb->cprb_ver_id = 0x04;
 	memcpy(cprb->func_id, "T4", 2);
coccicheck failed

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [help][coccinelle] coccicheck failed
  2020-06-18 13:23 [help][coccinelle] coccicheck failed Giacomo Picchiarelli
@ 2020-06-18 15:07 ` Randy Dunlap
  2020-06-18 15:23 ` Julia Lawall
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2020-06-18 15:07 UTC (permalink / raw)
  To: kernel-janitors

On 6/18/20 6:23 AM, Giacomo Picchiarelli wrote:
> Newbie here. I couldn't try the patch attached. 
> I'm using coccinelle (spatch version 1.0.4 with Python support and with PCRE support), 
> I'm having issues with the following command:
> 
> make coccicheck MODE=patch
> 
> "./tools/testing/selftests/net/hwtstamp_config.c:74:45-46: WARNING: Use ARRAY_SIZE
> 
> 807 811
> 
> coccicheck failed"
> 
> Applied to: commit 1b5044021070efa3259f3e9548dc35d1eb6aa844 (HEAD -> master, origin/master, origin/HEAD)
> Merge: 69119673bd50 dbed452a078d
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Wed Jun 17 11:29:37 2020 -0700
> 
> Suggestions?


Add "DEBUG_FILE=cocci.err" to the command line. "cocci.err" will contain
more detailed info about the failure, then someone might know what to do
about it.

-- 
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [help][coccinelle] coccicheck failed
  2020-06-18 13:23 [help][coccinelle] coccicheck failed Giacomo Picchiarelli
  2020-06-18 15:07 ` Randy Dunlap
@ 2020-06-18 15:23 ` Julia Lawall
  2020-06-18 16:45 ` Giacomo Picchiarelli
  2020-06-18 17:19 ` Randy Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-06-18 15:23 UTC (permalink / raw)
  To: kernel-janitors



On Thu, 18 Jun 2020, Giacomo Picchiarelli wrote:

> Newbie here. I couldn't try the patch attached.

Hi,

I'm not sure what you are trying to do.  The patch attached is a real
patch, not a Coccinelle semantic patch.

> I'm using coccinelle (spatch version 1.0.4 with Python support and with PCRE support),
> I'm having issues with the following command:
>
> make coccicheck MODE=patch
>
> "./tools/testing/selftests/net/hwtstamp_config.c:74:45-46: WARNING: Use ARRAY_SIZE
>
> 807 811
>
> coccicheck failed"

Randy's suggestion about DEBUG is good.  You can also get a more modern
version of Coccinelle from github.

julia


> Applied to: commit 1b5044021070efa3259f3e9548dc35d1eb6aa844 (HEAD -> master, origin/master, origin/HEAD)
> Merge: 69119673bd50 dbed452a078d
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Wed Jun 17 11:29:37 2020 -0700
>
> Suggestions?
>
> --
> Giacomo Picchiarelli <gpicchiarelli@gmail.com>
> GPG Key: 2E51 2591 F3E8 7CDC F504  140F 8559 3ACF 4691 ACC0
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [help][coccinelle] coccicheck failed
  2020-06-18 13:23 [help][coccinelle] coccicheck failed Giacomo Picchiarelli
  2020-06-18 15:07 ` Randy Dunlap
  2020-06-18 15:23 ` Julia Lawall
@ 2020-06-18 16:45 ` Giacomo Picchiarelli
  2020-06-18 17:19 ` Randy Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: Giacomo Picchiarelli @ 2020-06-18 16:45 UTC (permalink / raw)
  To: kernel-janitors

make coccicheck MODE=patch DEBUG_FILE=cocci3.err

result:

/usr/local/bin/spatch -D patch --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8 --chunksize 1

Python error: No module named coccilib.elems

Suggestions? Missing something?


On 18/06/20 17:23, Julia Lawall wrote:
>
> On Thu, 18 Jun 2020, Giacomo Picchiarelli wrote:
>
>> Newbie here. I couldn't try the patch attached.
> Hi,
>
> I'm not sure what you are trying to do.  The patch attached is a real
> patch, not a Coccinelle semantic patch.
>
>> I'm using coccinelle (spatch version 1.0.4 with Python support and with PCRE support),
>> I'm having issues with the following command:
>>
>> make coccicheck MODE=patch
>>
>> "./tools/testing/selftests/net/hwtstamp_config.c:74:45-46: WARNING: Use ARRAY_SIZE
>>
>> 807 811
>>
>> coccicheck failed"
> Randy's suggestion about DEBUG is good.  You can also get a more modern
> version of Coccinelle from github.
>
> julia

Hi Julia,
I'm actually having some issues with coccinelle compilation, I'm going to try with the newest version as soon as possible.
Thanks.

>
>
>> Applied to: commit 1b5044021070efa3259f3e9548dc35d1eb6aa844 (HEAD -> master, origin/master, origin/HEAD)
>> Merge: 69119673bd50 dbed452a078d
>> Author: Linus Torvalds <torvalds@linux-foundation.org>
>> Date:   Wed Jun 17 11:29:37 2020 -0700
>>
>> Suggestions?
>>
>> --
>> Giacomo Picchiarelli <gpicchiarelli@gmail.com>
>> GPG Key: 2E51 2591 F3E8 7CDC F504  140F 8559 3ACF 4691 ACC0
>>
>>
-- 
Giacomo Picchiarelli <gpicchiarelli@gmail.com>
GPG Key: 2E51 2591 F3E8 7CDC F504  140F 8559 3ACF 4691 ACC0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [help][coccinelle] coccicheck failed
  2020-06-18 13:23 [help][coccinelle] coccicheck failed Giacomo Picchiarelli
                   ` (2 preceding siblings ...)
  2020-06-18 16:45 ` Giacomo Picchiarelli
@ 2020-06-18 17:19 ` Randy Dunlap
  3 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2020-06-18 17:19 UTC (permalink / raw)
  To: kernel-janitors

On 6/18/20 9:45 AM, Giacomo Picchiarelli wrote:
> make coccicheck MODE=patch DEBUG_FILE=cocci3.err
> 
> result:
> 
> /usr/local/bin/spatch -D patch --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8 --chunksize 1
> 
> Python error: No module named coccilib.elems
> 
> Suggestions? Missing something?
> 

It's looking in the wrong location for the library files.
(We went thru this just last week.)

This is what fixed it for me:

$ cd /usr/local/lib
$ sudo ln ../lib64/coccinelle coccinelle

so that spatch can find the library file(s) in /usr/local/lib64
instead of in /usr/local/lib.


> 
> On 18/06/20 17:23, Julia Lawall wrote:
>>
>> On Thu, 18 Jun 2020, Giacomo Picchiarelli wrote:
>>
>>> Newbie here. I couldn't try the patch attached.
>> Hi,
>>
>> I'm not sure what you are trying to do.  The patch attached is a real
>> patch, not a Coccinelle semantic patch.
>>
>>> I'm using coccinelle (spatch version 1.0.4 with Python support and with PCRE support),
>>> I'm having issues with the following command:
>>>
>>> make coccicheck MODE=patch
>>>
>>> "./tools/testing/selftests/net/hwtstamp_config.c:74:45-46: WARNING: Use ARRAY_SIZE
>>>
>>> 807 811
>>>
>>> coccicheck failed"
>> Randy's suggestion about DEBUG is good.  You can also get a more modern
>> version of Coccinelle from github.
>>
>> julia
> 
> Hi Julia,
> I'm actually having some issues with coccinelle compilation, I'm going to try with the newest version as soon as possible.
> Thanks.
> 
>>
>>
>>> Applied to: commit 1b5044021070efa3259f3e9548dc35d1eb6aa844 (HEAD -> master, origin/master, origin/HEAD)
>>> Merge: 69119673bd50 dbed452a078d
>>> Author: Linus Torvalds <torvalds@linux-foundation.org>
>>> Date:   Wed Jun 17 11:29:37 2020 -0700
>>>
>>> Suggestions?
>>>
>>> --
>>> Giacomo Picchiarelli <gpicchiarelli@gmail.com>
>>> GPG Key: 2E51 2591 F3E8 7CDC F504  140F 8559 3ACF 4691 ACC0
>>>
>>>


-- 
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-18 17:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 13:23 [help][coccinelle] coccicheck failed Giacomo Picchiarelli
2020-06-18 15:07 ` Randy Dunlap
2020-06-18 15:23 ` Julia Lawall
2020-06-18 16:45 ` Giacomo Picchiarelli
2020-06-18 17:19 ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).