Message ID | 87aac8b8-4f30-2edd-4688-42d32d815cd1@users.sourceforge.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 18/01/2017 20:52, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 18 Jan 2017 20:43:41 +0100 > > Return directly after a call of the function "copy_from_user" failed > in a case block. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> The "out" label is now unused, so you should remove it. Paolo > --- > arch/mips/kvm/mips.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > index 06a60b19acfb..1dad78f74e8c 100644 > --- a/arch/mips/kvm/mips.c > +++ b/arch/mips/kvm/mips.c > @@ -1152,10 +1152,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > { > struct kvm_mips_interrupt irq; > > - r = -EFAULT; > if (copy_from_user(&irq, argp, sizeof(irq))) > - goto out; > - > + return -EFAULT; > kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__, > irq.irq); > > @@ -1165,9 +1163,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > case KVM_ENABLE_CAP: { > struct kvm_enable_cap cap; > > - r = -EFAULT; > if (copy_from_user(&cap, argp, sizeof(cap))) > - goto out; > + return -EFAULT; > r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); > break; > } > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 19/01/2017 11:20, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Thu, 19 Jan 2017 11:10:26 +0100 > > * Return directly after a call of the function "copy_from_user" failed > in a case block. > > * Delete the jump label "out" which became unnecessary with > this refactoring. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > > V2: > A label was also removed at the end. > > arch/mips/kvm/mips.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > index 06a60b19acfb..3534a0b9efed 100644 > --- a/arch/mips/kvm/mips.c > +++ b/arch/mips/kvm/mips.c > @@ -1152,10 +1152,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > { > struct kvm_mips_interrupt irq; > > - r = -EFAULT; > if (copy_from_user(&irq, argp, sizeof(irq))) > - goto out; > - > + return -EFAULT; > kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__, > irq.irq); > > @@ -1165,17 +1163,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > case KVM_ENABLE_CAP: { > struct kvm_enable_cap cap; > > - r = -EFAULT; > if (copy_from_user(&cap, argp, sizeof(cap))) > - goto out; > + return -EFAULT; > r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); > break; > } > default: > r = -ENOIOCTLCMD; > } > - > -out: > return r; > } > > Removing the label makes the patch worthwhile. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Markus,
[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.10-rc4 next-20170119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/MIPS-KVM-Return-directly-after-a-failed-copy_from_user-in-kvm_arch_vcpu_ioctl/20170119-154855
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: mips-malta_kvm_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
arch/mips/kvm/mips.c: In function 'kvm_arch_vcpu_ioctl':
>> arch/mips/kvm/mips.c:1175:1: error: label 'out' defined but not used [-Werror=unused-label]
out:
^~~
cc1: all warnings being treated as errors
vim +/out +1175 arch/mips/kvm/mips.c
5fafd8748 arch/mips/kvm/mips.c James Hogan 2014-12-08 1169 break;
5fafd8748 arch/mips/kvm/mips.c James Hogan 2014-12-08 1170 }
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1171 default:
4c73fb2b0 arch/mips/kvm/kvm_mips.c David Daney 2013-05-23 1172 r = -ENOIOCTLCMD;
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1173 }
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1174
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 @1175 out:
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1176 return r;
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1177 }
669e846e6 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 1178
:::::: The code at line 1175 was first introduced by commit
:::::: 669e846e6c4e13f16d7418973609931e362cb16a KVM/MIPS32: MIPS arch specific APIs for KVM
:::::: TO: Sanjay Lal <sanjayl@kymasys.com>
:::::: CC: Ralf Baechle <ralf@linux-mips.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Thu, Jan 19, 2017 at 11:27:52AM +0100, Paolo Bonzini wrote: > > > On 19/01/2017 11:20, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Thu, 19 Jan 2017 11:10:26 +0100 > > > > * Return directly after a call of the function "copy_from_user" failed > > in a case block. > > > > * Delete the jump label "out" which became unnecessary with > > this refactoring. > > > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > > --- > > > > V2: > > A label was also removed at the end. > > > > arch/mips/kvm/mips.c | 9 ++------- > > 1 file changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > > index 06a60b19acfb..3534a0b9efed 100644 > > --- a/arch/mips/kvm/mips.c > > +++ b/arch/mips/kvm/mips.c > > @@ -1152,10 +1152,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > > { > > struct kvm_mips_interrupt irq; > > > > - r = -EFAULT; > > if (copy_from_user(&irq, argp, sizeof(irq))) > > - goto out; > > - > > + return -EFAULT; > > kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__, > > irq.irq); > > > > @@ -1165,17 +1163,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, > > case KVM_ENABLE_CAP: { > > struct kvm_enable_cap cap; > > > > - r = -EFAULT; > > if (copy_from_user(&cap, argp, sizeof(cap))) > > - goto out; > > + return -EFAULT; > > r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); > > break; > > } > > default: > > r = -ENOIOCTLCMD; > > } > > - > > -out: > > return r; > > } > > > > > > Removing the label makes the patch worthwhile. > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Thanks Markus & Paolo. Looks better now. I'll apply for 4.11. Cheers James
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 06a60b19acfb..1dad78f74e8c 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -1152,10 +1152,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, { struct kvm_mips_interrupt irq; - r = -EFAULT; if (copy_from_user(&irq, argp, sizeof(irq))) - goto out; - + return -EFAULT; kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__, irq.irq); @@ -1165,9 +1163,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, case KVM_ENABLE_CAP: { struct kvm_enable_cap cap; - r = -EFAULT; if (copy_from_user(&cap, argp, sizeof(cap))) - goto out; + return -EFAULT; r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); break; }