diff options
-rw-r--r-- | arch/i386/boot/compressed/relocs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/i386/boot/compressed/relocs.c b/arch/i386/boot/compressed/relocs.c index 881951ca03e1..ce4fda261aaf 100644 --- a/arch/i386/boot/compressed/relocs.c +++ b/arch/i386/boot/compressed/relocs.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <endian.h> | 11 | #include <endian.h> |
12 | 12 | ||
13 | #define MAX_SHDRS 100 | 13 | #define MAX_SHDRS 100 |
14 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
14 | static Elf32_Ehdr ehdr; | 15 | static Elf32_Ehdr ehdr; |
15 | static Elf32_Shdr shdr[MAX_SHDRS]; | 16 | static Elf32_Shdr shdr[MAX_SHDRS]; |
16 | static Elf32_Sym *symtab[MAX_SHDRS]; | 17 | static Elf32_Sym *symtab[MAX_SHDRS]; |
@@ -71,7 +72,7 @@ static const char *sym_type(unsigned type) | |||
71 | #undef SYM_TYPE | 72 | #undef SYM_TYPE |
72 | }; | 73 | }; |
73 | const char *name = "unknown sym type name"; | 74 | const char *name = "unknown sym type name"; |
74 | if (type < sizeof(type_name)/sizeof(type_name[0])) { | 75 | if (type < ARRAY_SIZE(type_name)) { |
75 | name = type_name[type]; | 76 | name = type_name[type]; |
76 | } | 77 | } |
77 | return name; | 78 | return name; |
@@ -87,7 +88,7 @@ static const char *sym_bind(unsigned bind) | |||
87 | #undef SYM_BIND | 88 | #undef SYM_BIND |
88 | }; | 89 | }; |
89 | const char *name = "unknown sym bind name"; | 90 | const char *name = "unknown sym bind name"; |
90 | if (bind < sizeof(bind_name)/sizeof(bind_name[0])) { | 91 | if (bind < ARRAY_SIZE(bind_name)) { |
91 | name = bind_name[bind]; | 92 | name = bind_name[bind]; |
92 | } | 93 | } |
93 | return name; | 94 | return name; |
@@ -104,7 +105,7 @@ static const char *sym_visibility(unsigned visibility) | |||
104 | #undef SYM_VISIBILITY | 105 | #undef SYM_VISIBILITY |
105 | }; | 106 | }; |
106 | const char *name = "unknown sym visibility name"; | 107 | const char *name = "unknown sym visibility name"; |
107 | if (visibility < sizeof(visibility_name)/sizeof(visibility_name[0])) { | 108 | if (visibility < ARRAY_SIZE(visibility_name)) { |
108 | name = visibility_name[visibility]; | 109 | name = visibility_name[visibility]; |
109 | } | 110 | } |
110 | return name; | 111 | return name; |
@@ -128,7 +129,7 @@ static const char *rel_type(unsigned type) | |||
128 | #undef REL_TYPE | 129 | #undef REL_TYPE |
129 | }; | 130 | }; |
130 | const char *name = "unknown type rel type name"; | 131 | const char *name = "unknown type rel type name"; |
131 | if (type < sizeof(type_name)/sizeof(type_name[0])) { | 132 | if (type < ARRAY_SIZE(type_name)) { |
132 | name = type_name[type]; | 133 | name = type_name[type]; |
133 | } | 134 | } |
134 | return name; | 135 | return name; |