[Xen-devel,RFC,for-4.13,05/10] xen/arm: alternative: Remove unused parameter for alternative_if_not_cap

Message ID 20190926183808.11630-6-julien.grall@arm.com
State Superseded
Headers show
Series
  • xen/arm: XSA-201 and XSA-263 fixes
Related show

Commit Message

Julien Grall Sept. 26, 2019, 6:38 p.m.
The macro alternative_if_not_cap is taking two parameters. The second
parameter is never used and it is hard to see how this can be used
correctly as it is only protecting the alternative section magic.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/include/asm-arm/alternative.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Volodymyr Babchuk Sept. 27, 2019, 11:50 a.m. | #1
Julien Grall writes:

> The macro alternative_if_not_cap is taking two parameters. The second
> parameter is never used and it is hard to see how this can be used
> correctly as it is only protecting the alternative section magic.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr.babchuk@epam.com>

> ---
>  xen/include/asm-arm/alternative.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/xen/include/asm-arm/alternative.h b/xen/include/asm-arm/alternative.h
> index dedb6dd001..2830a6da2d 100644
> --- a/xen/include/asm-arm/alternative.h
> +++ b/xen/include/asm-arm/alternative.h
> @@ -116,13 +116,11 @@ int apply_alternatives(const struct alt_instr *start, const struct alt_instr *en
>   * The code that follows this macro will be assembled and linked as
>   * normal. There are no restrictions on this code.
>   */
> -.macro alternative_if_not cap, enable = 1
> -	.if \enable
> +.macro alternative_if_not cap
>  	.pushsection .altinstructions, "a"
>  	altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f
>  	.popsection
>  661:
> -	.endif
>  .endm
>  
>  /*
Stefano Stabellini Oct. 1, 2019, 8:55 p.m. | #2
On Fri, 27 Sep 2019, Volodymyr Babchuk wrote:
> 
> Julien Grall writes:
> 
> > The macro alternative_if_not_cap is taking two parameters. The second
> > parameter is never used and it is hard to see how this can be used
> > correctly as it is only protecting the alternative section magic.
> >
> > Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reviewed-by: Volodymyr Babchuk <volodymyr.babchuk@epam.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> > ---
> >  xen/include/asm-arm/alternative.h | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/xen/include/asm-arm/alternative.h b/xen/include/asm-arm/alternative.h
> > index dedb6dd001..2830a6da2d 100644
> > --- a/xen/include/asm-arm/alternative.h
> > +++ b/xen/include/asm-arm/alternative.h
> > @@ -116,13 +116,11 @@ int apply_alternatives(const struct alt_instr *start, const struct alt_instr *en
> >   * The code that follows this macro will be assembled and linked as
> >   * normal. There are no restrictions on this code.
> >   */
> > -.macro alternative_if_not cap, enable = 1
> > -	.if \enable
> > +.macro alternative_if_not cap
> >  	.pushsection .altinstructions, "a"
> >  	altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f
> >  	.popsection
> >  661:
> > -	.endif
> >  .endm
> >  
> >  /*
> 
> 
> -- 
> Volodymyr Babchuk at EPAM

Patch

diff --git a/xen/include/asm-arm/alternative.h b/xen/include/asm-arm/alternative.h
index dedb6dd001..2830a6da2d 100644
--- a/xen/include/asm-arm/alternative.h
+++ b/xen/include/asm-arm/alternative.h
@@ -116,13 +116,11 @@  int apply_alternatives(const struct alt_instr *start, const struct alt_instr *en
  * The code that follows this macro will be assembled and linked as
  * normal. There are no restrictions on this code.
  */
-.macro alternative_if_not cap, enable = 1
-	.if \enable
+.macro alternative_if_not cap
 	.pushsection .altinstructions, "a"
 	altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f
 	.popsection
 661:
-	.endif
 .endm
 
 /*