Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1466339 > unrolled thread
| Started by | Amitoj Kaur Chawla <amitoj1606@gmail.com> |
|---|---|
| First post | 2016-08-19 14:40 +0200 |
| Last post | 2016-08-19 19:00 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-08-19 14:40 +0200
Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions Julia Lawall <julia.lawall@lip6.fr> - 2016-08-19 14:50 +0200
Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-19 15:30 +0200
Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions Julia Lawall <julia.lawall@lip6.fr> - 2016-08-19 15:40 +0200
Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-19 19:00 +0200
| From | Amitoj Kaur Chawla <amitoj1606@gmail.com> |
|---|---|
| Date | 2016-08-19 14:40 +0200 |
| Subject | Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and memset with zalloc functions |
| Message-ID | <s7RfA-5Cv-11@gated-at.bofh.it> |
On Mon, Aug 1, 2016 at 4:53 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: >> +@vz1 depends on patch && !context && !org && !report@ >> +type T; >> +T *d; >> +statement S; >> +@@ >> + >> + d = >> +- vmalloc >> ++ vzalloc >> + (...); >> + if (!d) S >> +- memset(d, 0, sizeof(T)); >> + >> +@vz2 depends on patch && !context && !org && !report@ >> +expression d; >> +statement S; >> +@@ >> + >> + d = >> +- vmalloc >> ++ vzalloc >> + (...); >> + if (!d) S >> +- memset(d, 0, sizeof(*d)); > > I suggest to take another look at a few implementation details. > > 1. Would it make sense to merge such SmPL rules into one > so that code duplication could be reduced a bit > in such a script? > > 2. How do you think about to extend the shown check list > with the function "kvm_kvzalloc"? > Hi Markus, kvm_kvzalloc function doesn't fit the same pattern as the other functions in this semantic patch, and is kvm specific, so the semantic patch looks fine as is. Thanks, Amitoj > 3. Do you want to maintain a growing (?) function name list manually? > > Regards, > Markus
[toc] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-08-19 14:50 +0200 |
| Message-ID | <s7Rpg-5FZ-41@gated-at.bofh.it> |
| In reply to | #1466339 |
On Fri, 19 Aug 2016, Amitoj Kaur Chawla wrote: > On Mon, Aug 1, 2016 at 4:53 PM, SF Markus Elfring > <elfring@users.sourceforge.net> wrote: > >> +@vz1 depends on patch && !context && !org && !report@ > >> +type T; > >> +T *d; > >> +statement S; > >> +@@ > >> + > >> + d = > >> +- vmalloc > >> ++ vzalloc > >> + (...); > >> + if (!d) S > >> +- memset(d, 0, sizeof(T)); > >> + > >> +@vz2 depends on patch && !context && !org && !report@ > >> +expression d; > >> +statement S; > >> +@@ > >> + > >> + d = > >> +- vmalloc > >> ++ vzalloc > >> + (...); > >> + if (!d) S > >> +- memset(d, 0, sizeof(*d)); > > > > I suggest to take another look at a few implementation details. > > > > 1. Would it make sense to merge such SmPL rules into one > > so that code duplication could be reduced a bit > > in such a script? > > > > 2. How do you think about to extend the shown check list > > with the function "kvm_kvzalloc"? > > > > Hi Markus, > > kvm_kvzalloc function doesn't fit the same pattern as the other > functions in this semantic patch, and is kvm specific, so the > semantic patch looks fine as is. Acked-by: Julia Lawall <julia.lawall@lip6.fr> > > Thanks, > Amitoj > > > 3. Do you want to maintain a growing (?) function name list manually? > > > > Regards, > > Markus >
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-19 15:30 +0200 |
| Subject | Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions |
| Message-ID | <s7S1Y-68X-15@gated-at.bofh.it> |
| In reply to | #1466339 |
>> I suggest to take another look at a few implementation details. >> >> 1. Would it make sense to merge such SmPL rules into one >> so that code duplication could be reduced a bit >> in such a script? >> >> 2. How do you think about to extend the shown check list >> with the function "kvm_kvzalloc"? … > kvm_kvzalloc function doesn't fit the same pattern as the other > functions in this semantic patch, and is kvm specific, Has this one got a similar function property? Do you prefer to exclude such functions which belong to subsystems so far generally? > so the semantic patch looks fine as is. How do you think about to express the shown source code repetition as an aspect by an other script format? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-08-19 15:40 +0200 |
| Subject | Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions |
| Message-ID | <s7SbD-6dI-17@gated-at.bofh.it> |
| In reply to | #1466398 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, 19 Aug 2016, SF Markus Elfring wrote: > >> I suggest to take another look at a few implementation details. > >> > >> 1. Would it make sense to merge such SmPL rules into one > >> so that code duplication could be reduced a bit > >> in such a script? > >> > >> 2. How do you think about to extend the shown check list > >> with the function "kvm_kvzalloc"? > … > > kvm_kvzalloc function doesn't fit the same pattern as the other > > functions in this semantic patch, and is kvm specific, > > Has this one got a similar function property? Do you have any example where XXX followed by memset is converted to this function? > > Do you prefer to exclude such functions which belong to subsystems > so far generally? Yes, because it would introduce unwanted dependencies. > > > so the semantic patch looks fine as is. > > How do you think about to express the shown source code repetition > as an aspect by an other script format? It is fine as it is. julia
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-19 19:00 +0200 |
| Subject | Re: [Cocci] Coccinelle: Script to replace allocate and memset with zalloc functions |
| Message-ID | <s7Vjb-85Q-1@gated-at.bofh.it> |
| In reply to | #1466418 |
>> Do you prefer to exclude such functions which belong to subsystems >> so far generally? > > Yes, because it would introduce unwanted dependencies. Are the mentioned dependencies easier to handle for subsystems like "acpi", "dma" and "pci" (than "kvm")? Would anybody like to tackle any further software development challenges there? Regards, Markus
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web