Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1464699 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2016-08-17 20:10 +0200 |
| Last post | 2016-08-24 17:10 +0200 |
| Articles | 20 on this page of 41 — 7 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] KVM-S390: Fine-tuning for kvm_s390_import_bp_data() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-17 20:10 +0200
[PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-17 20:20 +0200
Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 15:10 +0200
Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation David Hildenbrand <dahi@linux.vnet.ibm.com> - 2016-08-22 15:10 +0200
Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation Christian Borntraeger <borntraeger@de.ibm.com> - 2016-08-24 17:20 +0200
[PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-24 20:40 +0200
[PATCH v2 1/2] KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-24 20:50 +0200
Re: [PATCH v2 1/2] KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-25 18:20 +0200
Re: KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-25 18:50 +0200
Re: Software evolution around scripts for the semantic patch langugae Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-25 19:50 +0200
Re: Software evolution around scripts for the semantic patch langugae SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-25 20:00 +0200
Re: Software evolution around scripts for the semantic patch langugae SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-25 19:50 +0200
Re: Software evolution around scripts for the semantic patch langugae Julia Lawall <julia.lawall@lip6.fr> - 2016-08-25 20:20 +0200
Re: Software evolution around scripts for the semantic patch langugae Julia Lawall <julia.lawall@lip6.fr> - 2016-08-25 20:30 +0200
Re: Software evolution around scripts for the semantic patch langugae Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-25 23:10 +0200
Re: Software evolution around scripts for the semantic patch langugae SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-25 20:30 +0200
[PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-24 20:50 +0200
Re: [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-25 21:30 +0200
Re: [PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() Christian Borntraeger <borntraeger@de.ibm.com> - 2016-08-25 19:10 +0200
[PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-17 20:20 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection David Hildenbrand <dahi@linux.vnet.ibm.com> - 2016-08-22 15:00 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 15:10 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-22 19:00 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 21:40 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-22 23:20 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 23:30 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Paolo Bonzini <pbonzini@redhat.com> - 2016-08-31 14:30 +0200
Re: [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection Christian Borntraeger <borntraeger@de.ibm.com> - 2016-08-24 17:20 +0200
Re: KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-27 18:20 +0200
[PATCH 4/4] KVM-S390: Delete an unnecessary initialisation for a buffer variable SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-17 20:20 +0200
Re: [PATCH 4/4] KVM-S390: Delete an unnecessary initialisation for a buffer variable Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 15:10 +0200
Re: [PATCH 4/4] KVM-S390: Delete an unnecessary initialisation for a buffer variable David Hildenbrand <dahi@linux.vnet.ibm.com> - 2016-08-22 15:10 +0200
[PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-17 20:20 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() walter harms <wharms@bfs.de> - 2016-08-18 09:30 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() Julia Lawall <julia.lawall@lip6.fr> - 2016-08-18 11:10 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() Paolo Bonzini <pbonzini@redhat.com> - 2016-08-18 12:10 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() walter harms <wharms@bfs.de> - 2016-08-18 13:00 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() Paolo Bonzini <pbonzini@redhat.com> - 2016-08-18 13:10 +0200
Re: [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() Cornelia Huck <cornelia.huck@de.ibm.com> - 2016-08-22 15:00 +0200
Re: Replacing specific kmalloc() calls by kmalloc_array()? SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-24 14:20 +0200
Re: Replacing specific kmalloc() calls by kmalloc_array()? Paolo Bonzini <pbonzini@redhat.com> - 2016-08-24 17:10 +0200
Page 1 of 3 [1] 2 3 Next page →
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-17 20:10 +0200 |
| Subject | [PATCH 0/4] KVM-S390: Fine-tuning for kvm_s390_import_bp_data() |
| Message-ID | <s7drP-4Al-9@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 17 Aug 2016 19:49:29 +0200 Some update suggestions were taken into account from static source code analysis. Markus Elfring (4): Improve determination of sizes Use memdup_user() Less function calls after error detection Delete an unnecessary initialisation arch/s390/kvm/guestdbg.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) -- 2.9.3
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-17 20:20 +0200 |
| Subject | [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation |
| Message-ID | <s7dBv-4DV-9@gated-at.bofh.it> |
| In reply to | #1464699 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Aug 2016 18:41:43 +0200
* Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.
This issue was detected by using the Coccinelle software.
* Return directly if this copy operation failed.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/s390/kvm/guestdbg.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index b68db4b..8f886ee 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -217,16 +217,9 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
return -EINVAL;
size = dbg->arch.nr_hw_bp * sizeof(*bp_data);
- bp_data = kmalloc(size, GFP_KERNEL);
- if (!bp_data) {
- ret = -ENOMEM;
- goto error;
- }
-
- if (copy_from_user(bp_data, dbg->arch.hw_bp, size)) {
- ret = -EFAULT;
- goto error;
- }
+ bp_data = memdup_user(dbg->arch.hw_bp, size);
+ if (IS_ERR(bp_data))
+ return PTR_ERR(bp_data);
for (i = 0; i < dbg->arch.nr_hw_bp; i++) {
switch (bp_data[i].type) {
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Date | 2016-08-22 15:10 +0200 |
| Subject | Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation |
| Message-ID | <s8X9f-6I9-1@gated-at.bofh.it> |
| In reply to | #1464702 |
On Wed, 17 Aug 2016 20:08:49 +0200 SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 17 Aug 2016 18:41:43 +0200 > > * Reuse existing functionality from memdup_user() instead of keeping > duplicate source code. > > This issue was detected by using the Coccinelle software. > > * Return directly if this copy operation failed. Looks sane, but please take a bit of care about the subject: It's a bit long, and the prefix should be "KVM: s390:". > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > arch/s390/kvm/guestdbg.c | 13 +++---------- > 1 file changed, 3 insertions(+), 10 deletions(-) Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> if Christian wants to apply this (unless I beat him to it).
[toc] | [prev] | [next] | [standalone]
| From | David Hildenbrand <dahi@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-22 15:10 +0200 |
| Subject | Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation |
| Message-ID | <s8X9f-6I9-3@gated-at.bofh.it> |
| In reply to | #1464702 |
> From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 17 Aug 2016 18:41:43 +0200 > > * Reuse existing functionality from memdup_user() instead of keeping > duplicate source code. > > This issue was detected by using the Coccinelle software. > > * Return directly if this copy operation failed. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> I like that. Thanks for running that analysis software against s390 KVM code! Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> David
[toc] | [prev] | [next] | [standalone]
| From | Christian Borntraeger <borntraeger@de.ibm.com> |
|---|---|
| Date | 2016-08-24 17:20 +0200 |
| Subject | Re: [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation |
| Message-ID | <s9I8a-42y-35@gated-at.bofh.it> |
| In reply to | #1464702 |
On 08/17/2016 02:08 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 17 Aug 2016 18:41:43 +0200
>
> * Reuse existing functionality from memdup_user() instead of keeping
> duplicate source code.
>
> This issue was detected by using the Coccinelle software.
>
> * Return directly if this copy operation failed.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I was going to apply this patch, but it probably makes sense to respin the
first patch first as suggested to avoid me fixing up the conflicts and then
you fixing up the new conflict.
So can you respin patch 1,2 as suggested and add the acks/rb for patch 2?
> ---
> arch/s390/kvm/guestdbg.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
> index b68db4b..8f886ee 100644
> --- a/arch/s390/kvm/guestdbg.c
> +++ b/arch/s390/kvm/guestdbg.c
> @@ -217,16 +217,9 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
> return -EINVAL;
>
> size = dbg->arch.nr_hw_bp * sizeof(*bp_data);
> - bp_data = kmalloc(size, GFP_KERNEL);
> - if (!bp_data) {
> - ret = -ENOMEM;
> - goto error;
> - }
> -
> - if (copy_from_user(bp_data, dbg->arch.hw_bp, size)) {
> - ret = -EFAULT;
> - goto error;
> - }
> + bp_data = memdup_user(dbg->arch.hw_bp, size);
> + if (IS_ERR(bp_data))
> + return PTR_ERR(bp_data);
>
> for (i = 0; i < dbg->arch.nr_hw_bp; i++) {
> switch (bp_data[i].type) {
>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-24 20:40 +0200 |
| Subject | [PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() |
| Message-ID | <s9LfI-66o-11@gated-at.bofh.it> |
| In reply to | #1469535 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 24 Aug 2016 20:20:02 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (2): Improve determination of sizes Use memdup_user() rather than duplicating code arch/s390/kvm/guestdbg.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-24 20:50 +0200 |
| Subject | [PATCH v2 1/2] KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() |
| Message-ID | <s9Lpn-69M-13@gated-at.bofh.it> |
| In reply to | #1469638 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Aug 2016 19:45:23 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kmalloc_array".
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
This issue was detected also by using the Coccinelle software.
* Replace the specification of data structures by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
* Delete the local variable "size" which became unnecessary with
this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v2: Rebased on source files from "Linux next-20160824".
Advices were integrated from source code review.
arch/s390/kvm/guestdbg.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index d1f8241..70b71ac 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -206,7 +206,7 @@ static int __import_wp_info(struct kvm_vcpu *vcpu,
int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
{
- int ret = 0, nr_wp = 0, nr_bp = 0, i, size;
+ int ret = 0, nr_wp = 0, nr_bp = 0, i;
struct kvm_hw_breakpoint *bp_data = NULL;
struct kvm_hw_wp_info_arch *wp_info = NULL;
struct kvm_hw_bp_info_arch *bp_info = NULL;
@@ -216,14 +216,17 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
else if (dbg->arch.nr_hw_bp > MAX_BP_COUNT)
return -EINVAL;
- size = dbg->arch.nr_hw_bp * sizeof(struct kvm_hw_breakpoint);
- bp_data = kmalloc(size, GFP_KERNEL);
+ bp_data = kmalloc_array(dbg->arch.nr_hw_bp,
+ sizeof(*bp_data),
+ GFP_KERNEL);
if (!bp_data) {
ret = -ENOMEM;
goto error;
}
- if (copy_from_user(bp_data, dbg->arch.hw_bp, size)) {
+ if (copy_from_user(bp_data,
+ dbg->arch.hw_bp,
+ sizeof(*bp_data) * dbg->arch.nr_hw_bp)) {
ret = -EFAULT;
goto error;
}
@@ -241,17 +244,19 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
}
}
- size = nr_wp * sizeof(struct kvm_hw_wp_info_arch);
- if (size > 0) {
- wp_info = kmalloc(size, GFP_KERNEL);
+ if (nr_wp > 0) {
+ wp_info = kmalloc_array(nr_wp,
+ sizeof(*wp_info),
+ GFP_KERNEL);
if (!wp_info) {
ret = -ENOMEM;
goto error;
}
}
- size = nr_bp * sizeof(struct kvm_hw_bp_info_arch);
- if (size > 0) {
- bp_info = kmalloc(size, GFP_KERNEL);
+ if (nr_bp > 0) {
+ bp_info = kmalloc_array(nr_bp,
+ sizeof(*bp_info),
+ GFP_KERNEL);
if (!bp_info) {
ret = -ENOMEM;
goto error;
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Date | 2016-08-25 18:20 +0200 |
| Subject | Re: [PATCH v2 1/2] KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() |
| Message-ID | <sa5xM-3jP-19@gated-at.bofh.it> |
| In reply to | #1469645 |
On Wed, 24 Aug 2016 20:36:26 +0200 SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 24 Aug 2016 19:45:23 +0200 > > * A multiplication for the size determination of a memory allocation > indicated that an array data structure should be processed. > Thus reuse the corresponding function "kmalloc_array". > > Suggested-by: Paolo Bonzini <pbonzini@redhat.com> > > This issue was detected also by using the Coccinelle software. Do you have the scripts you use published somewhere? > > * Replace the specification of data structures by pointer dereferences > to make the corresponding size determination a bit safer according to > the Linux coding style convention. > > * Delete the local variable "size" which became unnecessary with > this refactoring. I think your description is a bit on the verbose side, but not enough to gripe more. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > > v2: Rebased on source files from "Linux next-20160824". > Advices were integrated from source code review. > > arch/s390/kvm/guestdbg.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-25 18:50 +0200 |
| Subject | Re: KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() |
| Message-ID | <sa60O-3vb-21@gated-at.bofh.it> |
| In reply to | #1470251 |
>> This issue was detected also by using the Coccinelle software. > > Do you have the scripts you use published somewhere? Not yet. I hope that I can clarify a few more implementation details around my evolving scripts for the semantic patch language. I guess that this approach can be published with a higher confidence in the near future. Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Date | 2016-08-25 19:50 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa6WR-44Y-1@gated-at.bofh.it> |
| In reply to | #1470251 |
On Thu, 25 Aug 2016 19:34:29 +0200 SF Markus Elfring <elfring@users.sourceforge.net> wrote: > >> This issue was detected also by using the Coccinelle software. > > > > Do you have the scripts you use published somewhere? > > I would like to add another view for the corresponding software development. > > The complete answer depends also on the kind of "scripts" > you are looking for. Would you like to clarify any details > a bit more here? You obviously run some kind of semantic patching. It would really help ease review if you could publish the semantic patches that generate your patches - that is probably more helpful in review than just posting the generated patches. And it does not need to be "complete", I'd think everyone on the cc: list here is able to handle a cocchinelle patch, for example.
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-25 20:00 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa76x-48p-5@gated-at.bofh.it> |
| In reply to | #1470301 |
> You obviously run some kind of semantic patching. Yes. - I developed some software for search patterns I became interested in. > It would really help ease review if you could publish the semantic patches > that generate your patches This is reasonable. > - that is probably more helpful in review than just posting the generated patches. Which of the available scripts (or SmPL source files) would you like to discuss further? > And it does not need to be "complete", I would feel more comfortable with publishing further scripts here when I can become more confident about relevant safety checks in this software area. > I'd think everyone on the cc: list here is able to handle a cocchinelle patch, > for example. Interesting view … I did not expect this kind of expertise by default. Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-25 19:50 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa6WR-44Y-3@gated-at.bofh.it> |
| In reply to | #1470251 |
>> This issue was detected also by using the Coccinelle software. > > Do you have the scripts you use published somewhere? I would like to add another view for the corresponding software development. The complete answer depends also on the kind of "scripts" you are looking for. Would you like to clarify any details a bit more here? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-08-25 20:20 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa7pT-4uc-19@gated-at.bofh.it> |
| In reply to | #1470302 |
On Thu, 25 Aug 2016, SF Markus Elfring wrote: > >> This issue was detected also by using the Coccinelle software. > > > > Do you have the scripts you use published somewhere? > > I would like to add another view for the corresponding software development. > > The complete answer depends also on the kind of "scripts" > you are looking for. Would you like to clarify any details > a bit more here? I imagine that she is asking for: @@ expression e1,e2,e3; @@ - kmalloc(e1 * e2, e3) + kmalloc_array(e1, e2, e3) Or some close variant. It seems pretty straightforward to provide and can help orient the reader to what is going on. julia
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2016-08-25 20:30 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa7zA-4yA-19@gated-at.bofh.it> |
| In reply to | #1470318 |
On Thu, 25 Aug 2016, SF Markus Elfring wrote: > > Or some close variant. > > I have got more script variants evolving in my software collection. > > There are further approaches available from various contributors, > aren't there? What she is asking for is a concise and precise decription of what you have done. If you have some other variants, eg controlling where the sizeof argument is (left or right of *), you don't necessarily have to include it in the patch, if such a rule was not used for the specific patch anyway. julia > > 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 >
[toc] | [prev] | [next] | [standalone]
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Date | 2016-08-25 23:10 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <saa4p-6jm-19@gated-at.bofh.it> |
| In reply to | #1470327 |
On Thu, 25 Aug 2016 14:23:35 -0400 (EDT) Julia Lawall <julia.lawall@lip6.fr> wrote: > On Thu, 25 Aug 2016, SF Markus Elfring wrote: > > > > Or some close variant. > > > > I have got more script variants evolving in my software collection. > > > > There are further approaches available from various contributors, > > aren't there? > > What she is asking for is a concise and precise decription of what you > have done. If you have some other variants, eg controlling where the > sizeof argument is (left or right of *), you don't necessarily have to > include it in the patch, if such a rule was not used for the specific > patch anyway. *nod* If I see a patch that says "I've run the following cocchinelle patch to perform $TRANSFORMATION, and here's the result", I can be reasonably sure that the result will be what is intended to be changed in the first place (and I can assess whether the change makes sense at all.) If I see only the resulting patch, I won't know whether you have performed the changes manually (and possibly introduced bugs, as happens to all of us.) Moreover, a good semantic patch is useful to others as well and might even be reused in other contexts that have similar requirements. You really lose value if you don't publish them.
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-25 20:30 +0200 |
| Subject | Re: Software evolution around scripts for the semantic patch langugae |
| Message-ID | <sa7zA-4yA-21@gated-at.bofh.it> |
| In reply to | #1470318 |
> Or some close variant. I have got more script variants evolving in my software collection. There are further approaches available from various contributors, aren't there? Regards, Markus
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-24 20:50 +0200 |
| Subject | [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code |
| Message-ID | <s9Lpn-69M-19@gated-at.bofh.it> |
| In reply to | #1469638 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 24 Aug 2016 20:10:09 +0200
* Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.
This issue was detected by using the Coccinelle software.
* Return directly if this copy operation failed.
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v2: Rebased on source files from "Linux next-20160824".
arch/s390/kvm/guestdbg.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index 70b71ac..d7c6a7f 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -216,20 +216,10 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
else if (dbg->arch.nr_hw_bp > MAX_BP_COUNT)
return -EINVAL;
- bp_data = kmalloc_array(dbg->arch.nr_hw_bp,
- sizeof(*bp_data),
- GFP_KERNEL);
- if (!bp_data) {
- ret = -ENOMEM;
- goto error;
- }
-
- if (copy_from_user(bp_data,
- dbg->arch.hw_bp,
- sizeof(*bp_data) * dbg->arch.nr_hw_bp)) {
- ret = -EFAULT;
- goto error;
- }
+ bp_data = memdup_user(dbg->arch.hw_bp,
+ sizeof(*bp_data) * dbg->arch.nr_hw_bp);
+ if (IS_ERR(bp_data))
+ return PTR_ERR(bp_data);
for (i = 0; i < dbg->arch.nr_hw_bp; i++) {
switch (bp_data[i].type) {
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Date | 2016-08-25 21:30 +0200 |
| Subject | Re: [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code |
| Message-ID | <sa8vD-5bX-3@gated-at.bofh.it> |
| In reply to | #1469649 |
On Wed, 24 Aug 2016 20:40:03 +0200 SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 24 Aug 2016 20:10:09 +0200 > > * Reuse existing functionality from memdup_user() instead of keeping > duplicate source code. > > This issue was detected by using the Coccinelle software. > > * Return directly if this copy operation failed. > > Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > > v2: Rebased on source files from "Linux next-20160824". > > arch/s390/kvm/guestdbg.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
[toc] | [prev] | [next] | [standalone]
| From | Christian Borntraeger <borntraeger@de.ibm.com> |
|---|---|
| Date | 2016-08-25 19:10 +0200 |
| Subject | Re: [PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() |
| Message-ID | <sa6k9-3QR-15@gated-at.bofh.it> |
| In reply to | #1469638 |
On 08/24/2016 02:30 PM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 24 Aug 2016 20:20:02 +0200 > > A few update suggestions were taken into account > from static source code analysis. > > Markus Elfring (2): > Improve determination of sizes > Use memdup_user() rather than duplicating code > > arch/s390/kvm/guestdbg.c | 31 +++++++++++++------------------ > 1 file changed, 13 insertions(+), 18 deletions(-) > Thanks applied.
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2016-08-17 20:20 +0200 |
| Subject | [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection |
| Message-ID | <s7dBw-4DV-19@gated-at.bofh.it> |
| In reply to | #1464699 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 17 Aug 2016 19:25:50 +0200
The kfree() function was called in a few cases by the
kvm_s390_import_bp_data() function during error handling
even if a passed variable contained a null pointer.
Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/s390/kvm/guestdbg.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index 8f886ee..f2514af 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -239,7 +239,7 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
wp_info = kmalloc(size, GFP_KERNEL);
if (!wp_info) {
ret = -ENOMEM;
- goto error;
+ goto free_bp_data;
}
}
size = nr_bp * sizeof(*bp_info);
@@ -247,7 +247,7 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
bp_info = kmalloc(size, GFP_KERNEL);
if (!bp_info) {
ret = -ENOMEM;
- goto error;
+ goto free_wp_info;
}
}
@@ -257,7 +257,7 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
ret = __import_wp_info(vcpu, &bp_data[i],
&wp_info[nr_wp]);
if (ret)
- goto error;
+ goto free_bp_info;
nr_wp++;
break;
case KVM_HW_BP:
@@ -273,10 +273,12 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
vcpu->arch.guestdbg.nr_hw_wp = nr_wp;
vcpu->arch.guestdbg.hw_wp_info = wp_info;
return 0;
-error:
- kfree(bp_data);
- kfree(wp_info);
+free_bp_info:
kfree(bp_info);
+free_wp_info:
+ kfree(wp_info);
+free_bp_data:
+ kfree(bp_data);
return ret;
}
--
2.9.3
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web