Re: Re[v2]: Use of GCC plugin instead ISO C

2018-03-06 Thread Progyan Bhattacharya
On Thu, 2018-03-01 at 13:42 -0800, Randy Dunlap wrote:
> If you would build with V=1 and capture all of the output (lots of
> it!) to a file,
> you could search it for "pedantic" to see where/why it is used.
> 
> I have no idea about the permission problem that you quoted above.

Sorry for the misunderstanding!
Here is the full build log for

    make V=1

-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)make -f ./Makefile silentoldconfig
make -f ./scripts/Makefile.build obj=scripts/basic
(cat /dev/null; ) > scripts/basic/modules.order
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig silentoldconfig
mkdir -p include/config include/generated
test -e include/generated/autoksyms.h || \
touch   include/generated/autoksyms.h
scripts/kconfig/conf  --silentoldconfig Kconfig
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=scripts/basic
(cat /dev/null; ) > scripts/basic/modules.order
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=arch/x86/tools relocs
set -e; : '  CHK include/config/kernel.release'; mkdir -p include/config/;  
echo "4.16.0-rc4$(/bin/sh ./scripts/setlocalversion .)" < 
include/config/auto.conf > include/config/kernel.release.tmp; if [ -r 
include/config/kernel.release ] && cmp -s include/config/kernel.release 
include/config/kernel.release.tmp; then rm -f 
include/config/kernel.release.tmp; else : '  UPD 
include/config/kernel.release'; mv -f include/config/kernel.release.tmp 
include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic \
src=uapi/asm obj=arch/x86/include/generated/uapi/asm
make -f ./scripts/Makefile.asm-generic \
src=asm obj=arch/x86/include/generated/asm
set -e; : '  CHK include/generated/uapi/linux/version.h'; mkdir -p 
include/generated/uapi/linux/;   (echo \#define LINUX_VERSION_CODE 266240; echo 
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < Makefile > 
include/generated/uapi/linux/version.h.tmp; if [ -r 
include/generated/uapi/linux/version.h ] && cmp -s 
include/generated/uapi/linux/version.h 
include/generated/uapi/linux/version.h.tmp; then rm -f 
include/generated/uapi/linux/version.h.tmp; else : '  UPD 
include/generated/uapi/linux/version.h'; mv -f 
include/generated/uapi/linux/version.h.tmp 
include/generated/uapi/linux/version.h; fi
rm -f include/linux/version.h
set -e; : '  CHK include/generated/utsrelease.h'; mkdir -p 
include/generated/;  if [ `echo -n "4.16.0-rc4+" | wc -c ` -gt 64 ]; then 
echo '"4.16.0-rc4+" exceeds 64 characters' >&2; exit 1; fi; (echo \#define 
UTS_RELEASE \"4.16.0-rc4+\";) < include/config/kernel.release > 
include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && 
cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then 
rm -f include/generated/utsrelease.h.tmp; else : '  UPD 
include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp 
include/generated/utsrelease.h; fi
mkdir -p .tmp_versions ; rm -f .tmp_versions/*
make -f ./scripts/Makefile.build obj=arch/x86/purgatory 
arch/x86/purgatory/kexec-purgatory.c
  gcc -Wp,-MD,arch/x86/purgatory/.purgatory.o.d  -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include 
-I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi 
-include ./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR 
-fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss 
-fno-builtin -ffreestanding -c -MD -Os -mcmodel=large -m64 -fno-PIE
-DKBUILD_BASENAME='"purgatory"'  -DKBUILD_MODNAME='"purgatory"' -c -o 
arch/x86/purgatory/.tmp_purgatory.o arch/x86/purgatory/purgatory.c
  if [ "" = "-pg" ]; then if [ arch/x86/purgatory/purgatory.o != 
"scripts/mod/empty.o" ]; then ./scripts/recordmcount  
"arch/x86/purgatory/purgatory.o"; fi; fi;
  gcc -Wp,-MD,arch/x86/purgatory/.sha256.o.d  -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include 
-I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi 
-include ./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR 
-fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss 
-fno-builtin -ffreestanding -c -MD -Os -mcmodel=large -m64 -fno-PIE
-DKBUILD_BASENAME='"sha256"'  -DKBUILD_MODNAME='"sha256"' -c -o 
arch/x86/purgatory/.tmp_sha256.o arch/x86/purgatory/sha256.c
  if [ "" = "-pg" ]; then if [ arch/x86/purgatory/sha256.o != 
"scripts/mod/empty.o" ]; then ./scripts/rec

Re: Re[v2]: Use of GCC plugin instead ISO C

2018-03-06 Thread Progyan Bhattacharya
On Thu, 2018-03-01 at 13:42 -0800, Randy Dunlap wrote:
> If you would build with V=1 and capture all of the output (lots of
> it!) to a file,
> you could search it for "pedantic" to see where/why it is used.
> 
> I have no idea about the permission problem that you quoted above.

Sorry for the misunderstanding!
Here is the full build log for

    make V=1

-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)make -f ./Makefile silentoldconfig
make -f ./scripts/Makefile.build obj=scripts/basic
(cat /dev/null; ) > scripts/basic/modules.order
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig silentoldconfig
mkdir -p include/config include/generated
test -e include/generated/autoksyms.h || \
touch   include/generated/autoksyms.h
scripts/kconfig/conf  --silentoldconfig Kconfig
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=scripts/basic
(cat /dev/null; ) > scripts/basic/modules.order
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=arch/x86/tools relocs
set -e; : '  CHK include/config/kernel.release'; mkdir -p include/config/;  
echo "4.16.0-rc4$(/bin/sh ./scripts/setlocalversion .)" < 
include/config/auto.conf > include/config/kernel.release.tmp; if [ -r 
include/config/kernel.release ] && cmp -s include/config/kernel.release 
include/config/kernel.release.tmp; then rm -f 
include/config/kernel.release.tmp; else : '  UPD 
include/config/kernel.release'; mv -f include/config/kernel.release.tmp 
include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic \
src=uapi/asm obj=arch/x86/include/generated/uapi/asm
make -f ./scripts/Makefile.asm-generic \
src=asm obj=arch/x86/include/generated/asm
set -e; : '  CHK include/generated/uapi/linux/version.h'; mkdir -p 
include/generated/uapi/linux/;   (echo \#define LINUX_VERSION_CODE 266240; echo 
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < Makefile > 
include/generated/uapi/linux/version.h.tmp; if [ -r 
include/generated/uapi/linux/version.h ] && cmp -s 
include/generated/uapi/linux/version.h 
include/generated/uapi/linux/version.h.tmp; then rm -f 
include/generated/uapi/linux/version.h.tmp; else : '  UPD 
include/generated/uapi/linux/version.h'; mv -f 
include/generated/uapi/linux/version.h.tmp 
include/generated/uapi/linux/version.h; fi
rm -f include/linux/version.h
set -e; : '  CHK include/generated/utsrelease.h'; mkdir -p 
include/generated/;  if [ `echo -n "4.16.0-rc4+" | wc -c ` -gt 64 ]; then 
echo '"4.16.0-rc4+" exceeds 64 characters' >&2; exit 1; fi; (echo \#define 
UTS_RELEASE \"4.16.0-rc4+\";) < include/config/kernel.release > 
include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && 
cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then 
rm -f include/generated/utsrelease.h.tmp; else : '  UPD 
include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp 
include/generated/utsrelease.h; fi
mkdir -p .tmp_versions ; rm -f .tmp_versions/*
make -f ./scripts/Makefile.build obj=arch/x86/purgatory 
arch/x86/purgatory/kexec-purgatory.c
  gcc -Wp,-MD,arch/x86/purgatory/.purgatory.o.d  -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include 
-I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi 
-include ./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR 
-fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss 
-fno-builtin -ffreestanding -c -MD -Os -mcmodel=large -m64 -fno-PIE
-DKBUILD_BASENAME='"purgatory"'  -DKBUILD_MODNAME='"purgatory"' -c -o 
arch/x86/purgatory/.tmp_purgatory.o arch/x86/purgatory/purgatory.c
  if [ "" = "-pg" ]; then if [ arch/x86/purgatory/purgatory.o != 
"scripts/mod/empty.o" ]; then ./scripts/recordmcount  
"arch/x86/purgatory/purgatory.o"; fi; fi;
  gcc -Wp,-MD,arch/x86/purgatory/.sha256.o.d  -nostdinc -isystem 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include 
-I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi 
-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi 
-include ./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR 
-fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss 
-fno-builtin -ffreestanding -c -MD -Os -mcmodel=large -m64 -fno-PIE
-DKBUILD_BASENAME='"sha256"'  -DKBUILD_MODNAME='"sha256"' -c -o 
arch/x86/purgatory/.tmp_sha256.o arch/x86/purgatory/sha256.c
  if [ "" = "-pg" ]; then if [ arch/x86/purgatory/sha256.o != 
"scripts/mod/empty.o" ]; then ./scripts/rec

Re[v2]: Use of GCC plugin instead ISO C

2018-02-28 Thread Progyan Bhattacharya
On Thu, 2018-02-22 at 20:07 +0530, Progyan Bhattacharya wrote:
> On Sun, 2018-02-18 at 08:47 -0800, Randy Dunlap wrote:
> > You could try (re)building with V=1 on the "make" command line and
> > capture
> > the output to see where the "pedantic" is coming from.
> 
> This is a late reply.
> I did what you told me and the build failed at following point:
> 
>   /bin/sh: /home/progyan/Programs/Linux/tools/objtool/.objtool-
> in.o.cmd: Permission denied
> 
> I am not sure what permission it wants or what to make of it.
> 
> Thanks in advance.

-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Re[v2]: Use of GCC plugin instead ISO C

2018-02-28 Thread Progyan Bhattacharya
On Thu, 2018-02-22 at 20:07 +0530, Progyan Bhattacharya wrote:
> On Sun, 2018-02-18 at 08:47 -0800, Randy Dunlap wrote:
> > You could try (re)building with V=1 on the "make" command line and
> > capture
> > the output to see where the "pedantic" is coming from.
> 
> This is a late reply.
> I did what you told me and the build failed at following point:
> 
>   /bin/sh: /home/progyan/Programs/Linux/tools/objtool/.objtool-
> in.o.cmd: Permission denied
> 
> I am not sure what permission it wants or what to make of it.
> 
> Thanks in advance.

-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Re: Use of GCC plugin instead ISO C

2018-02-22 Thread Progyan Bhattacharya
On Sun, 2018-02-18 at 08:47 -0800, Randy Dunlap wrote:
> You could try (re)building with V=1 on the "make" command line and
> capture
> the output to see where the "pedantic" is coming from.

This is a late reply.
I did what you told me and the build failed at following point:

/bin/sh: /home/progyan/Programs/Linux/tools/objtool/.objtool-
in.o.cmd: Permission denied

I am not sure what permission it wants or what to make of it.

Thanks in advance.
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Re: Use of GCC plugin instead ISO C

2018-02-22 Thread Progyan Bhattacharya
On Sun, 2018-02-18 at 08:47 -0800, Randy Dunlap wrote:
> You could try (re)building with V=1 on the "make" command line and
> capture
> the output to see where the "pedantic" is coming from.

This is a late reply.
I did what you told me and the build failed at following point:

/bin/sh: /home/progyan/Programs/Linux/tools/objtool/.objtool-
in.o.cmd: Permission denied

I am not sure what permission it wants or what to make of it.

Thanks in advance.
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Use of GCC plugin instead ISO C

2018-02-18 Thread Progyan Bhattacharya
Hi Again,

According to last time talked, you said me to avoid "-Werror=pedantic"
flag to build the GNU specific plugins instead of Standard ISO C. I
changed my default compiler flags and tried to rebuild. But I am still
getting the same error messages at:

CC /***/Linux/tools/objtool/arch/x86/decode.o

All of them were arising due to same "-pedantic" flag being enabled.
1. Range expression in Case statements were not allowed.
2. Use of braced-group were not allowed in MACRO definition.
3. Pointer arithmetic with void pointer was not allowed.

I took a look on related Makefiles, but found none with "-pedantic" or
"-Werror=pedantic" flag.

Flags I found being used in compilation so far,

tools/objtool/Makefile:
-Wall -Werror -Wno-switch-default -Wno-switch-enum -Wno-packed
tools/scripts/Makefile.include:
-Wbad-function-cast -Wdeclaration-after-statement -Wformat-
security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-
prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition
-Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-
default -Wswitch-enum -Wundef -Wwrite-strings -Wformat

Compiler I am using:
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

Thanks in advance.
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Use of GCC plugin instead ISO C

2018-02-18 Thread Progyan Bhattacharya
Hi Again,

According to last time talked, you said me to avoid "-Werror=pedantic"
flag to build the GNU specific plugins instead of Standard ISO C. I
changed my default compiler flags and tried to rebuild. But I am still
getting the same error messages at:

CC /***/Linux/tools/objtool/arch/x86/decode.o

All of them were arising due to same "-pedantic" flag being enabled.
1. Range expression in Case statements were not allowed.
2. Use of braced-group were not allowed in MACRO definition.
3. Pointer arithmetic with void pointer was not allowed.

I took a look on related Makefiles, but found none with "-pedantic" or
"-Werror=pedantic" flag.

Flags I found being used in compilation so far,

tools/objtool/Makefile:
-Wall -Werror -Wno-switch-default -Wno-switch-enum -Wno-packed
tools/scripts/Makefile.include:
-Wbad-function-cast -Wdeclaration-after-statement -Wformat-
security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-
prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition
-Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-
default -Wswitch-enum -Wundef -Wwrite-strings -Wformat

Compiler I am using:
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

Thanks in advance.
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-17 Thread Progyan Bhattacharya
On Fri, 2018-02-16 at 17:47 +0100, Peter Zijlstra wrote:
> On Fri, Feb 16, 2018 at 08:35:11AM -0600, Josh Poimboeuf wrote:
> > On Fri, Feb 16, 2018 at 07:55:13PM +0530, Progyan Bhattacharya
> > wrote:
> > > Replace range expressions with seperate individual cases, i.e.
> > > convert case 1...3: to case 1: case 2: case 3
> > > Range expression within case statements are non-standard C code
> > > and can create issues over compiler and platform variety.
> > > 
> > > While compiling with gcc 4.8 (RHEL) I encountered this error on
> > > range expression in case statements:
> > > error: range expressions in switch statements are non-standard [-
> > > Werror=pedantic]
> > > 
> > > Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
> > 
> > Hi Progyan,
> > 
> > Thank you for the patch.
> > 
> > I think this makes the code unnecessarily verbose and less
> > readable.  We
> > rely on many such GCC extensions, and we don't aim to comply with
> > standard C.  And AFAIK, we don't use -Werror=pedantic in the
> > kernel.
> 
> Agreed, it makes the code actively worse. Just don't use
> error=pedantic.

But I cannot figure it out how Werror=pedantic flag is being set. :(
 
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


Re: [PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-17 Thread Progyan Bhattacharya
On Fri, 2018-02-16 at 17:47 +0100, Peter Zijlstra wrote:
> On Fri, Feb 16, 2018 at 08:35:11AM -0600, Josh Poimboeuf wrote:
> > On Fri, Feb 16, 2018 at 07:55:13PM +0530, Progyan Bhattacharya
> > wrote:
> > > Replace range expressions with seperate individual cases, i.e.
> > > convert case 1...3: to case 1: case 2: case 3
> > > Range expression within case statements are non-standard C code
> > > and can create issues over compiler and platform variety.
> > > 
> > > While compiling with gcc 4.8 (RHEL) I encountered this error on
> > > range expression in case statements:
> > > error: range expressions in switch statements are non-standard [-
> > > Werror=pedantic]
> > > 
> > > Signed-off-by: Progyan Bhattacharya 
> > 
> > Hi Progyan,
> > 
> > Thank you for the patch.
> > 
> > I think this makes the code unnecessarily verbose and less
> > readable.  We
> > rely on many such GCC extensions, and we don't aim to comply with
> > standard C.  And AFAIK, we don't use -Werror=pedantic in the
> > kernel.
> 
> Agreed, it makes the code actively worse. Just don't use
> error=pedantic.

But I cannot figure it out how Werror=pedantic flag is being set. :(
 
-- 
Regards,
Progyan Bhattacharya
(http://codeprogyan.me)


[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
Cc: Josh Poimboeuf <jpoim...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Nick Desaulniers <nick.desaulni...@gmail.com>
Cc: Lukas Bulwahn <lukas.bulw...@gmail.com>
Cc: Nicholas Mc Guire <der.h...@hofr.at>
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..e6803dd79958 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+   case 0x51:
+   case 0x52:
+   case 0x53:
+   case 0x54:
+   case 0x55:
+   case 0x56:
+   case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+   case 0x59:
+   case 0x5a:
+   case 0x5b:
+   case 0x5c:
+   case 0x5d:
+   case 0x5e:
+   case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+   case 0x71:
+   case 0x72:
+   case 0x73:
+   case 0x74:
+   case 0x75:
+   case 0x76:
+   case 0x77:
+   case 0x78:
+   case 0x79:
+   case 0x7a:
+   case 0x7b:
+   case 0x7c:
+   case 0x7d:
+   case 0x7e:
+   case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
    break;
 
-- 
Regards,
Progyan Bhattacharya
http://codeprogyan.me
2.16.1



[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya 
Cc: Josh Poimboeuf 
Cc: Peter Zijlstra 
Cc: Ingo Molnar 
Cc: Nick Desaulniers 
Cc: Lukas Bulwahn 
Cc: Nicholas Mc Guire 
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..e6803dd79958 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+   case 0x51:
+   case 0x52:
+   case 0x53:
+   case 0x54:
+   case 0x55:
+   case 0x56:
+   case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+   case 0x59:
+   case 0x5a:
+   case 0x5b:
+   case 0x5c:
+   case 0x5d:
+   case 0x5e:
+   case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+   case 0x71:
+   case 0x72:
+   case 0x73:
+   case 0x74:
+   case 0x75:
+   case 0x76:
+   case 0x77:
+   case 0x78:
+   case 0x79:
+   case 0x7a:
+   case 0x7b:
+   case 0x7c:
+   case 0x7d:
+   case 0x7e:
+   case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
break;
 
-- 
Regards,
Progyan Bhattacharya
http://codeprogyan.me
2.16.1



[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
Cc: Josh Poimboeuf <jpoim...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Nick Desaulniers <nick.desaulni...@gmail.com>
Cc: Lukas Bulwahn <lukas.bulw...@gmail.com>
Cc: Nicholas Mc Guire <der.h...@hofr.at>
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..4fb9b1307598 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+case 0x51:
+case 0x52:
+case 0x53:
+case 0x54:
+case 0x55:
+case 0x56:
+case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+case 0x59:
+case 0x5a:
+case 0x5b:
+case 0x5c:
+case 0x5d:
+case 0x5e:
+case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+case 0x71:
+case 0x72:
+case 0x73:
+case 0x74:
+case 0x75:
+case 0x76:
+case 0x77:
+case 0x78:
+case 0x79:
+case 0x7a:
+case 0x7b:
+case 0x7c:
+case 0x7d:
+case 0x7e:
+case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
break;
 
-- 
2.16.1



[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya 
Cc: Josh Poimboeuf 
Cc: Peter Zijlstra 
Cc: Ingo Molnar 
Cc: Nick Desaulniers 
Cc: Lukas Bulwahn 
Cc: Nicholas Mc Guire 
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..4fb9b1307598 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+case 0x51:
+case 0x52:
+case 0x53:
+case 0x54:
+case 0x55:
+case 0x56:
+case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+case 0x59:
+case 0x5a:
+case 0x5b:
+case 0x5c:
+case 0x5d:
+case 0x5e:
+case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+case 0x71:
+case 0x72:
+case 0x73:
+case 0x74:
+case 0x75:
+case 0x76:
+case 0x77:
+case 0x78:
+case 0x79:
+case 0x7a:
+case 0x7b:
+case 0x7c:
+case 0x7d:
+case 0x7e:
+case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
break;
 
-- 
2.16.1



[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
Cc: Josh Poimboeuf <jpoim...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Nick Desaulniers <nick.desaulni...@gmail.com>
Cc: Lukas Bulwahn <lukas.bulw...@gmail.com>
Cc: Nicholas Mc Guire <der.h...@hofr.at>
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..b4433433863b 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+case 0x51:
+case 0x52:
+case 0x53:
+case 0x54:
+case 0x55:
+case 0x56:
+case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+case 0x59:
+case 0x5a:
+case 0x5b:
+case 0x5c:
+case 0x5d:
+case 0x5e:
+case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+case 0x71:
+case 0x72:
+case 0x73:
+case 0x74:
+case 0x75:
+case 0x76:
+case 0x77:
+case 0x78:
+case 0x79:
+case 0x7a:
+case 0x7b:
+case 0x7c:
+case 0x7d:
+case 0x7e:
+case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
break;
 
-- 
2.16.1



[PATCH] objtool/x86: Replace Non-standard Range Expression in Case

2018-02-16 Thread Progyan Bhattacharya
Replace range expressions with seperate individual cases, i.e. convert case 
1...3: to case 1: case 2: case 3
Range expression within case statements are non-standard C code and can create 
issues over compiler and platform variety.

While compiling with gcc 4.8 (RHEL) I encountered this error on range 
expression in case statements:
error: range expressions in switch statements are non-standard 
[-Werror=pedantic]

Signed-off-by: Progyan Bhattacharya 
Cc: Josh Poimboeuf 
Cc: Peter Zijlstra 
Cc: Ingo Molnar 
Cc: Nick Desaulniers 
Cc: Lukas Bulwahn 
Cc: Nicholas Mc Guire 
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 35 ---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..b4433433863b 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -143,7 +143,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
}
break;
 
-   case 0x50 ... 0x57:
+   case 0x50:
+case 0x51:
+case 0x52:
+case 0x53:
+case 0x54:
+case 0x55:
+case 0x56:
+case 0x57:
 
/* push reg */
*type = INSN_STACK;
@@ -153,7 +160,14 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
 
break;
 
-   case 0x58 ... 0x5f:
+   case 0x58:
+case 0x59:
+case 0x5a:
+case 0x5b:
+case 0x5c:
+case 0x5d:
+case 0x5e:
+case 0x5f:
 
/* pop reg */
*type = INSN_STACK;
@@ -171,7 +185,22 @@ int arch_decode_instruction(struct elf *elf, struct 
section *sec,
op->dest.type = OP_DEST_PUSH;
break;
 
-   case 0x70 ... 0x7f:
+   case 0x70:
+case 0x71:
+case 0x72:
+case 0x73:
+case 0x74:
+case 0x75:
+case 0x76:
+case 0x77:
+case 0x78:
+case 0x79:
+case 0x7a:
+case 0x7b:
+case 0x7c:
+case 0x7d:
+case 0x7e:
+case 0x7f:
*type = INSN_JUMP_CONDITIONAL;
break;
 
-- 
2.16.1



[PATCH] Drivers/mfd: Remove Non-standard Case Statements

2018-02-15 Thread Progyan Bhattacharya
Remove Range Expressions from Case Statements and replace them with equivalent 
If-Else ladder. Comments are kept as is for understanding.

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
Cc: Lee Jones <lee.jo...@linaro.org>
Cc: patc...@opensource.cirrus.com
Cc: linux-kernel@vger.kernel.org
---
 drivers/mfd/cs47l24-tables.c | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/cs47l24-tables.c b/drivers/mfd/cs47l24-tables.c
index c090974340ad..99eeb6bac5d5 100644
--- a/drivers/mfd/cs47l24-tables.c
+++ b/drivers/mfd/cs47l24-tables.c
@@ -783,19 +783,23 @@ static const struct reg_default cs47l24_reg_default[] = {
 
 static bool cs47l24_is_adsp_memory(unsigned int reg)
 {
-   switch (reg) {
-   case 0x20 ... 0x205fff: /* DSP2 PM */
-   case 0x28 ... 0x281fff: /* DSP2 ZM */
-   case 0x29 ... 0x2a7fff: /* DSP2 XM */
-   case 0x2a8000 ... 0x2b3fff: /* DSP2 YM */
-   case 0x30 ... 0x308fff: /* DSP3 PM */
-   case 0x38 ... 0x381fff: /* DSP3 ZM */
-   case 0x39 ... 0x3a7fff: /* DSP3 XM */
-   case 0x3a8000 ... 0x3b3fff: /* DSP3 YM */
-   return true;
-   default:
-   return false;
-   }
+if (reg >= 0x20 && reg <= 0x205fff) /* DSP2 PM */
+return true;
+if (reg >= 0x28 && reg <= 0x281fff) /* DSP2 ZM */
+return true;
+if (reg >= 0x29 && reg <= 0x2a7fff) /* DSP2 XM */
+return true;
+if (reg >= 0x2a8000 && reg <= 0x2b3fff) /* DSP2 YM */
+return true;
+if (reg <= 0x30 && reg >= 0x308fff) /* DSP3 PM */
+return true;
+if (reg <= 0x38 && reg >= 0x381fff) /* DSP3 ZM */
+return true;
+if (reg <= 0x39 && reg >= 0x3a7fff) /* DSP3 XM */
+return true;
+if (reg <= 0x3a8000 && reg >= 0x3b3fff) /* DSP3 YM */
+return true;
+return false;
 }
 
 static bool cs47l24_readable_register(struct device *dev, unsigned int reg)
-- 
2.16.1



[PATCH] Drivers/mfd: Remove Non-standard Case Statements

2018-02-15 Thread Progyan Bhattacharya
Remove Range Expressions from Case Statements and replace them with equivalent 
If-Else ladder. Comments are kept as is for understanding.

Signed-off-by: Progyan Bhattacharya 
Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Cc: linux-kernel@vger.kernel.org
---
 drivers/mfd/cs47l24-tables.c | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/cs47l24-tables.c b/drivers/mfd/cs47l24-tables.c
index c090974340ad..99eeb6bac5d5 100644
--- a/drivers/mfd/cs47l24-tables.c
+++ b/drivers/mfd/cs47l24-tables.c
@@ -783,19 +783,23 @@ static const struct reg_default cs47l24_reg_default[] = {
 
 static bool cs47l24_is_adsp_memory(unsigned int reg)
 {
-   switch (reg) {
-   case 0x20 ... 0x205fff: /* DSP2 PM */
-   case 0x28 ... 0x281fff: /* DSP2 ZM */
-   case 0x29 ... 0x2a7fff: /* DSP2 XM */
-   case 0x2a8000 ... 0x2b3fff: /* DSP2 YM */
-   case 0x30 ... 0x308fff: /* DSP3 PM */
-   case 0x38 ... 0x381fff: /* DSP3 ZM */
-   case 0x39 ... 0x3a7fff: /* DSP3 XM */
-   case 0x3a8000 ... 0x3b3fff: /* DSP3 YM */
-   return true;
-   default:
-   return false;
-   }
+if (reg >= 0x20 && reg <= 0x205fff) /* DSP2 PM */
+return true;
+if (reg >= 0x28 && reg <= 0x281fff) /* DSP2 ZM */
+return true;
+if (reg >= 0x29 && reg <= 0x2a7fff) /* DSP2 XM */
+return true;
+if (reg >= 0x2a8000 && reg <= 0x2b3fff) /* DSP2 YM */
+return true;
+if (reg <= 0x30 && reg >= 0x308fff) /* DSP3 PM */
+return true;
+if (reg <= 0x38 && reg >= 0x381fff) /* DSP3 ZM */
+return true;
+if (reg <= 0x39 && reg >= 0x3a7fff) /* DSP3 XM */
+return true;
+if (reg <= 0x3a8000 && reg >= 0x3b3fff) /* DSP3 YM */
+return true;
+return false;
 }
 
 static bool cs47l24_readable_register(struct device *dev, unsigned int reg)
-- 
2.16.1



[PATCH] Build: Scripts/Makefile: Remove Repeated Lines

2018-02-14 Thread Progyan Bhattacharya
Last two lines of code was repreated and was causing build error.

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
Cc: Arnd Bergmann <a...@arndb.de>
Cc: Daniel Golle <dan...@makrotopia.org>
Cc: Joe Perches <j...@perches.com>
Cc: Neil Armstrong <narmstr...@baylibre.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Stephen Rothwell <s...@canb.auug.org.au>
---
 scripts/Makefile.kasan | 4 
 1 file changed, 4 deletions(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index b7b9ecef44cc..69552a39951d 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -45,7 +45,3 @@ endif
 CFLAGS_KASAN_NOSANITIZE := -fno-builtin
 
 endif
-
-CFLAGS_KASAN_NOSANITIZE := -fno-builtin
-
-endif
-- 
2.16.1



[PATCH] Build: Scripts/Makefile: Remove Repeated Lines

2018-02-14 Thread Progyan Bhattacharya
Last two lines of code was repreated and was causing build error.

Signed-off-by: Progyan Bhattacharya 
Cc: Arnd Bergmann 
Cc: Daniel Golle 
Cc: Joe Perches 
Cc: Neil Armstrong 
Cc: Andrew Morton 
Cc: Stephen Rothwell 
---
 scripts/Makefile.kasan | 4 
 1 file changed, 4 deletions(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index b7b9ecef44cc..69552a39951d 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -45,7 +45,3 @@ endif
 CFLAGS_KASAN_NOSANITIZE := -fno-builtin
 
 endif
-
-CFLAGS_KASAN_NOSANITIZE := -fno-builtin
-
-endif
-- 
2.16.1



[PATCH] x86/build: Add arch/x86/tools/insn_decoder_test to gitignore

2018-02-03 Thread Progyan Bhattacharya
The file was generated by make command and should not be in source tree

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
---
 arch/x86/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/.gitignore b/arch/x86/.gitignore
index aff152c87cf4..5a82bac5e0bc 100644
--- a/arch/x86/.gitignore
+++ b/arch/x86/.gitignore
@@ -1,6 +1,7 @@
 boot/compressed/vmlinux
 tools/test_get_len
 tools/insn_sanity
+tools/insn_decoder_test
 purgatory/kexec-purgatory.c
 purgatory/purgatory.ro
 
-- 
2.15.1




[PATCH] x86/build: Add arch/x86/tools/insn_decoder_test to gitignore

2018-02-03 Thread Progyan Bhattacharya
The file was generated by make command and should not be in source tree

Signed-off-by: Progyan Bhattacharya 
---
 arch/x86/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/.gitignore b/arch/x86/.gitignore
index aff152c87cf4..5a82bac5e0bc 100644
--- a/arch/x86/.gitignore
+++ b/arch/x86/.gitignore
@@ -1,6 +1,7 @@
 boot/compressed/vmlinux
 tools/test_get_len
 tools/insn_sanity
+tools/insn_decoder_test
 purgatory/kexec-purgatory.c
 purgatory/purgatory.ro
 
-- 
2.15.1




[PATCH] x86/build: Add arch/x86/tools/insn_decoder_test

2018-02-03 Thread Progyan Bhattacharya
The file was generated by make command and should not be in source tree

Signed-off-by: Progyan Bhattacharya <progy...@acm.org>
---
 arch/x86/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/.gitignore b/arch/x86/.gitignore
index aff152c87cf4..5a82bac5e0bc 100644
--- a/arch/x86/.gitignore
+++ b/arch/x86/.gitignore
@@ -1,6 +1,7 @@
 boot/compressed/vmlinux
 tools/test_get_len
 tools/insn_sanity
+tools/insn_decoder_test
 purgatory/kexec-purgatory.c
 purgatory/purgatory.ro
 
-- 
2.15.1




[PATCH] x86/build: Add arch/x86/tools/insn_decoder_test

2018-02-03 Thread Progyan Bhattacharya
The file was generated by make command and should not be in source tree

Signed-off-by: Progyan Bhattacharya 
---
 arch/x86/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/.gitignore b/arch/x86/.gitignore
index aff152c87cf4..5a82bac5e0bc 100644
--- a/arch/x86/.gitignore
+++ b/arch/x86/.gitignore
@@ -1,6 +1,7 @@
 boot/compressed/vmlinux
 tools/test_get_len
 tools/insn_sanity
+tools/insn_decoder_test
 purgatory/kexec-purgatory.c
 purgatory/purgatory.ro
 
-- 
2.15.1