Skip to content

Commit d27fff3

Browse files
lukasstraub2richardweinberger
authored andcommitted
um: Cleanup compiler warning in arch/x86/um/tls_32.c
arch.tls_array is statically allocated so checking for NULL doesn't make sense. This causes the compiler warning below. Remove the checks to silence these warnings. ../arch/x86/um/tls_32.c: In function 'get_free_idx': ../arch/x86/um/tls_32.c:68:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 68 | if (!t->arch.tls_array) | ^ In file included from ../arch/x86/um/asm/processor.h:10, from ../include/linux/rcupdate.h:30, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../arch/x86/um/tls_32.c:7: ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ ../arch/x86/um/tls_32.c: In function 'get_tls_entry': ../arch/x86/um/tls_32.c:243:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 243 | if (!t->arch.tls_array) | ^ ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ Signed-off-by: Lukas Straub <lukasstraub2@web.de> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 61670b4 commit d27fff3

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

arch/x86/um/tls_32.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task)
6565
struct thread_struct *t = &task->thread;
6666
int idx;
6767

68-
if (!t->arch.tls_array)
69-
return GDT_ENTRY_TLS_MIN;
70-
7168
for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++)
7269
if (!t->arch.tls_array[idx].present)
7370
return idx + GDT_ENTRY_TLS_MIN;
@@ -240,9 +237,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info,
240237
{
241238
struct thread_struct *t = &task->thread;
242239

243-
if (!t->arch.tls_array)
244-
goto clear;
245-
246240
if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
247241
return -EINVAL;
248242

0 commit comments

Comments
 (0)