From patchwork Mon Oct 24 11:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402343wru; Mon, 24 Oct 2022 04:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V56Yrd/vVfwcW9InL8lA+lndeX6sgMpHE2YeA/tTTYQv2hDSc6GusGd8/+admXw1x2F1T X-Received: by 2002:a63:fa4d:0:b0:43c:7fa:95f7 with SMTP id g13-20020a63fa4d000000b0043c07fa95f7mr27436944pgk.48.1666612195748; Mon, 24 Oct 2022 04:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612195; cv=none; d=google.com; s=arc-20160816; b=oduYE8IaORu+dYgXq6X7E2W3MnW4K9wrP7nOWzO95VUwMl9ThOaBHdOMFqZCviH9Fs qZEQN+j/g1C4Y+LF5B7yuREE07dYjTCXdgKameKvYRJkAJUtnCQR/4n4yy8cFGRONUk8 v26f2A3UhT1rMw5AidQTZLFE0cYFOO9Khf5Z8cJNSc+nUEY8uk9KPABz0mL0JGhn3SM+ uuZ34dXdL4WoCnqstgbc1U0hmAhiPPlEtWg4DpwjYXBVNc81Qq6Zka1WnVmI+ooQT+jp JHYqr04ZLIOzfWjw0ZaKnPprWA1KvDV0HUji0/fTmNcPxyy4uqS33tgSyVEpfEuZ49lQ 60GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GAx14qZ/ic3vPEeRcHCZo2zZBpbv4W8RwlKzHLNdHt8=; b=GwqPzvIGwAZX2sAOUiNX4jXB9NzYWtE+XviEIPtn9A/Arp58x8ZeXxTVRZgfClnjBe Dhf09rM5qnOAf42oVOx5byWkdYOGnmHjvP7sOFrlwq33Mna46qNJEex5YvwlV5jcxhSj AjFYGc38KDuzzKB9uVkqvtwVESk+wNrfGNStRBmAEGhd7KkY7y7ryqRfCHwN1TMV0TK+ 88NRPIotAMUaD/64UeqDzbFjaczJSIBVo1iBx+dbxsNSVxcTK8NVVUX1GC/HfyZz7YwY WweF91Rd8eeMuJt5npHZ/aOS9YsJgW6KZGVEMOKSaNa+LpkEaRDwbsKIL2nAtYmzyxwE NGAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fh+sYvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a17090ad3ce00b001f31f339134si7593905pjw.152.2022.10.24.04.49.42; Mon, 24 Oct 2022 04:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fh+sYvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbiJXLsg (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiJXLrp (ORCPT ); Mon, 24 Oct 2022 07:47:45 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E7A76566; Mon, 24 Oct 2022 04:43:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id ACF7CCE1323; Mon, 24 Oct 2022 11:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3807C433C1; Mon, 24 Oct 2022 11:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611639; bh=FX9PiNDyjGyaqH8fteImXXQwO/zrtRRI/sMYSTvfFk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fh+sYvncJSC96kgi6VKoNdKig8ieGbyPfdOAsoxIVyCxdmJ7f/xckQe9Vr//eN3lg RI+bZxPIjopY4qoASP4g/ehJQFckIHcrxM4ElGTM0ZwU7wJMRLyokTCPw47EHyzCpy /c+/Nrw4mWD+iyT/lI2o78dyp1wyKw0BaStkuOtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 4.9 024/159] um: Cleanup compiler warning in arch/x86/um/tls_32.c Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024112950.283971691@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569549669234897?= X-GMAIL-MSGID: =?utf-8?q?1747569549669234897?= From: Lukas Straub [ Upstream commit d27fff3499671dc23a08efd01cdb8b3764a391c4 ] 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 Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/um/tls_32.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index 48e38584d5c1..0a4dba5f0542 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c @@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task) struct thread_struct *t = &task->thread; int idx; - if (!t->arch.tls_array) - return GDT_ENTRY_TLS_MIN; - for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) if (!t->arch.tls_array[idx].present) return idx + GDT_ENTRY_TLS_MIN; @@ -242,9 +239,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info, { struct thread_struct *t = &task->thread; - if (!t->arch.tls_array) - goto clear; - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL;