Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1232092 > unrolled thread
| Started by | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| First post | 2015-09-24 15:00 +0200 |
| Last post | 2015-10-03 09:10 +0200 |
| Articles | 10 on this page of 30 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] coccinelle: assign signed result to unsigned variable Andrzej Hajda <a.hajda@samsung.com> - 2015-09-24 15:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-24 18:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Andrzej Hajda <a.hajda@samsung.com> - 2015-09-25 12:10 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-25 18:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 09:50 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 11:10 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 11:50 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 11:50 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 12:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 12:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 13:50 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 16:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 17:30 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 17:40 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 18:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-26 18:00 +0200
Re: [PATCH] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-26 18:10 +0200
[PATCH v2] coccinelle: assign signed result to unsigned variable Andrzej Hajda <a.hajda@samsung.com> - 2015-09-28 13:00 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-28 13:40 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable Andrzej Hajda <a.hajda@samsung.com> - 2015-09-28 14:10 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-10-01 00:00 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-28 14:10 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable Andrzej Hajda <a.hajda@samsung.com> - 2015-09-28 14:20 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-28 14:30 +0200
Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-28 14:50 +0200
Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-28 15:00 +0200
Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-28 15:20 +0200
Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-28 16:00 +0200
Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-09-28 17:10 +0200
Re: [PATCH v2] coccinelle: assign signed result to unsigned variable Julia Lawall <julia.lawall@lip6.fr> - 2015-10-03 09:10 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-10-01 00:00 +0200 |
| Subject | Re: [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qexzQ-LW-1@gated-at.bofh.it> |
| In reply to | #1234072 |
On Mon, 28 Sep 2015, Andrzej Hajda wrote: > On 09/28/2015 01:32 PM, Julia Lawall wrote: > > > > On Mon, 28 Sep 2015, Andrzej Hajda wrote: > > > >> Assigning signed function result to unsigned variable can indicate error. > >> To decrease number of false positives patch looks if after assignment > >> there is also check for negative values of the result. > >> > >> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> > >> --- > >> Hi Julia, > >> > >> Thanks for the hint. Now it looks much better. > >> Summarizing this patch has found 20 problems and has 22 false positives [1][2]. > > Do you have some examples of the false positives? > ./drivers/acpi/acpica/nsarguments.c:130:1: WARNING: Assigning signed result to > unsigned variable: required_param_count = METHOD_GET_ARG_COUNT(...) > ./drivers/char/agp/intel-gtt.c:361:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = KB(...) > ./drivers/char/agp/intel-gtt.c:364:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:367:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:382:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:385:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:388:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:391:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:394:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:397:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:400:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:403:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:406:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:409:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:412:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:415:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/char/agp/intel-gtt.c:418:3: WARNING: Assigning signed result to > unsigned variable: stolen_size = MB(...) > ./drivers/input/touchscreen/cyttsp4_core.c:967:1: WARNING: Assigning signed > result to unsigned variable: num_cur_tch = GET_NUM_TOUCHES(...) > ./drivers/pinctrl/freescale/pinctrl-imx.c:648:2: WARNING: Assigning signed > result to unsigned variable: nfuncs = of_get_child_count(...) > ./fs/btrfs/file.c:1572:2: WARNING: Assigning signed result to unsigned variable: > copied = btrfs_copy_from_user(...) > ./fs/xfs/libxfs/xfs_inode_fork.c:541:2: WARNING: Assigning signed result to > unsigned variable: new_size = XFS_BMAP_BROOT_SPACE_CALC(...) > > As you see most of them are macros, of_get_child_count and btrfs_copy_from_user > return int but always non-negative. OK, perhaps we could just live with them... julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-09-28 14:10 +0200 |
| Subject | Re: [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdFpL-5fT-9@gated-at.bofh.it> |
| In reply to | #1234048 |
> +// Options: --include-headers --all-includes How do you think about the reuse of the parameter "--recursive-includes" here? Will the list of checked function calls become more complete then? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| Date | 2015-09-28 14:20 +0200 |
| Subject | Re: [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdFzs-5rF-5@gated-at.bofh.it> |
| In reply to | #1234071 |
On 09/28/2015 02:07 PM, SF Markus Elfring wrote: >> +// Options: --include-headers --all-includes > > How do you think about the reuse of the parameter "--recursive-includes" here? Last time I have tried it, kernel source check took more than 10 hours, so I gave up. Regards Andrzej > > Will the list of checked function calls become more complete then? > > Regards, > Markus > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-09-28 14:30 +0200 |
| Subject | Re: [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdFJ8-5CT-1@gated-at.bofh.it> |
| In reply to | #1234074 |
>> How do you think about the reuse of the parameter "--recursive-includes" here? > > Last time I have tried it, kernel source check took more than 10 hours, > so I gave up. This is interesting background information. There are opportunities for more fine-tuning of such a source code analysis, aren't there? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-09-28 14:50 +0200 |
| Subject | Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdG2v-5Zh-39@gated-at.bofh.it> |
| In reply to | #1234077 |
On Mon, 28 Sep 2015, SF Markus Elfring wrote: > >> How do you think about the reuse of the parameter "--recursive-includes" here? > > > > Last time I have tried it, kernel source check took more than 10 hours, > > so I gave up. > > This is interesting background information. > > There are opportunities for more fine-tuning of such a source code analysis, > aren't there? I guess parallelism would be helpful? You could try the following options: -j n --chunksize 10 --recursive-includes --include-headers-for-types where n is the number of cores that you want to use. Parsed header files will be cached within chunks. I don't really know what is the best chunksize. julia > > Regards, > Markus > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-09-28 15:00 +0200 |
| Subject | Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdGca-6aB-21@gated-at.bofh.it> |
| In reply to | #1234111 |
> I guess parallelism would be helpful? > You could try the following options: > > -j n --chunksize 10 --recursive-includes --include-headers-for-types > > where n is the number of cores that you want to use. Has the make target "coccicheck" direct support for such special parameters? > Parsed header files will be cached within chunks. Can the Coccinelle software work together with a kind of "precompiled header database"? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-09-28 15:20 +0200 |
| Subject | Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdGvv-6My-1@gated-at.bofh.it> |
| In reply to | #1234120 |
On Mon, 28 Sep 2015, SF Markus Elfring wrote: > > I guess parallelism would be helpful? > > You could try the following options: > > > > -j n --chunksize 10 --recursive-includes --include-headers-for-types > > > > where n is the number of cores that you want to use. > > Has the make target "coccicheck" direct support for such special parameters? > > > > Parsed header files will be cached within chunks. > > Can the Coccinelle software work together with a kind of "precompiled > header database"? There is an option --use-cache, which caches the compiled code on the disk. But I have not found the effects to be very satisfactory. It is still necessary to read in the serialized code. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-09-28 16:00 +0200 |
| Subject | Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdH8e-1eq-11@gated-at.bofh.it> |
| In reply to | #1234139 |
>> Can the Coccinelle software work together with a kind of "precompiled >> header database"? > > There is an option --use-cache, which caches the compiled code > on the disk. But I have not found the effects to be very satisfactory. I am curious if this situation will be improved by further software evolution. Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-09-28 17:10 +0200 |
| Subject | Re: [Cocci] [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qdIdY-301-23@gated-at.bofh.it> |
| In reply to | #1234175 |
On Mon, 28 Sep 2015, SF Markus Elfring wrote: > >> Can the Coccinelle software work together with a kind of "precompiled > >> header database"? > > > > There is an option --use-cache, which caches the compiled code > > on the disk. But I have not found the effects to be very satisfactory. > > I am curious if this situation will be improved by further software evolution. There are no plans in that direction. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2015-10-03 09:10 +0200 |
| Subject | Re: [PATCH v2] coccinelle: assign signed result to unsigned variable |
| Message-ID | <qfp7b-36r-3@gated-at.bofh.it> |
| In reply to | #1234048 |
Some comments: If you get 20 good results and 22 false positives, I'm not sure whether high confidence is justified. That seemes more like moderate confidence. On the other hand, I think it is possible to get rid of the false positives. The false positives are coming from the fact that you have: if ( \( vu < 0 \| vu <= 0 \) ) S1 else S2 This can be flipped around to if ( ! \( vu < 0 \| vu <= 0 \) ) S2 else S1 and then when we propagate the ! into the disjunction, we get v >= 0 for the first condition and v > 0 for the second condition. v >= 0 is always true, so it could be reasonable to highlight it, but v > 0 is a perfectly reasonable test for an unsigned value, and is where you are getting the false positives from. If you want to get rid of both v >= 0 and v < 0 then you can just put disable neg_if in the initial @@, just after r, ie @r disable neg_if@ On the other hand, if you want to keep the warning on v >= 0 but drop the warning on v > 0, then you will have to split the rules and put the disable neg_if on the one for v <= 0. I think it would also be reasonable to merge the proposed semantic patches. I guess this one gives most of the results anyway? With recursive_includes, I got 70 results, at least 20 of which should be false positives due to the MB case. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web