Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5664940ima; Tue, 5 Feb 2019 16:14:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IbWN/EPiLdX4YZ55lJjIlPF3KCUMjqaE6Zyt9UVFZ4jt72YibvUQw9x1vHhvdBjQv1a2bvx X-Received: by 2002:a17:902:8b88:: with SMTP id ay8mr7899667plb.55.1549412066689; Tue, 05 Feb 2019 16:14:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549412066; cv=none; d=google.com; s=arc-20160816; b=YMT6YPBxx7mqVfKVTZYdFBM7xx2I3NXqBU7FvYwAO320kryxw+jrVfe5PATdMbQ/aO 095WeY6uAJsrzxrvqL163YhEmWccUYS+EkObVje04arAp13/owXf1eqxGcKJafygoX3g K3HGqgYoHA4QIxDsq8TobpmhN7o7faXl5shT6tUZA7gkMqVPLjhNXs9w7JsVyeQvERrQ rjyd4M0RUgU2Czu0l+TFwxaUEAq5IQ/6nMEwKZv3bzh6QbFVgBa7MUDzFUr+BpzNCe8P xXqg/XF8onQDwqql+sg5vZ1NHub8YQ9TAzwTS2x4Pm+KbuN2vE0bJZYaHUkPVc/qKipy 2Zig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=03zM+rsG3etqoUUtwSyaoBhp2feBDhfBWZLsIpE5Slw=; b=yYLdSB3NErJu3kaI3n8wJdLfLM3bp7qNLtXuQxHjdYjqlQEmiLXz34Hh2ZUxlo/dCz RQc4yyPTjjmK2rZZzv++SalS9TLa6NkP5lajkuo13ro8Ljk6urWiNRzHcOD+4zR8MmbO C/rhGuRuZlA33oI57EfmKgsUbFxvE8qagifA9P6ybYFvrhCAv5yIPZwGzjAwGZQ6PThN w+CCIpjBbJb+iRusjYLW4WhGeqE2OASJG9WFsJQ3VQ4gcdEL7/kkRn/SAM8Mbyex1vrs c0HSgwyQgErd5/+HBf325SJ1HJtGX8sJZW2YFcTsgFB0G4kPWaR3jop2EzoHCtOyPKDC DKNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=Ga+a1+iq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si4077567pgq.424.2019.02.05.16.14.11; Tue, 05 Feb 2019 16:14:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=Ga+a1+iq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfBFAL1 (ORCPT + 99 others); Tue, 5 Feb 2019 19:11:27 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42098 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727902AbfBFALY (ORCPT ); Tue, 5 Feb 2019 19:11:24 -0500 Received: by mail-ed1-f66.google.com with SMTP id r15so3020345eds.9 for ; Tue, 05 Feb 2019 16:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=03zM+rsG3etqoUUtwSyaoBhp2feBDhfBWZLsIpE5Slw=; b=Ga+a1+iqN03qpOufPf3RnsBJdAAkfKoDCtLVGJsznvVN5vV2xSUmpsDdUmxKOK11Ux 1RG0uENOFT36UoJy1hzPu8ESSWB8kLPmUOoBTiIEfkIdLhkwMZnJNCxC/dgkrSFL6Hh9 CiQEsJ/AyHwPwSJ40URAmnaYlBLAEN4xQaNVFCMD92xltmHfUo6K/4HGCV5RxZsSaTf7 Y9BnqmjQQbMLx0RLITyrbNdA/vIS7ltpRryxZZix18KuqqDWZEeXxAEeJSAULopCVB1z rqn30t9jeUBxCnySsGvDu3g7f94rer7gKN4eTSrYlnJDZZhnLVzMS093Jk2Ym5qO15MV P4Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=03zM+rsG3etqoUUtwSyaoBhp2feBDhfBWZLsIpE5Slw=; b=CME3yA72YG/l9TYErXK1675XD9KGdVf1VezN2+Y9QI5+xJEdQ9tti6qsIPHBd02aXN Fxwm4iz5/44Lnzap8+pJJ32NYvgOaSDJpDvFTpJhk5jm0bdrTzAFsetveblS22kPFP/P 9AESK3+L1hVYFjSn8+4On6OvQiSBiaQhxznej8LgYvGV1Sp76S8Rlj9UK0t035CtmEp5 5SppO1+TpAUJAMl/Zqpm40c5RO2xiiQLumkp32c99eJ2gF2x9lDRRfGA8nuY7MAeUWV5 l8KeVg0kFfPWWT79It5LgL0y9QgTDQD9w1BQScuAsKLFUrKlLQdz5fwtabkBr1dWvTC3 AtCQ== X-Gm-Message-State: AHQUAuYUX6asubKNEHTeDHKS7q5d7Isd4vL0sZYC05/IyYRaoy/rNFRo HFQZ/KJR371OJLwftpYH8oJJSPexr7Y= X-Received: by 2002:a17:906:2893:: with SMTP id o19mr5452714ejd.146.1549411882850; Tue, 05 Feb 2019 16:11:22 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id p30sm5489594eda.68.2019.02.05.16.11.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 05 Feb 2019 16:11:22 -0800 (PST) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov , Adrian Reber , Andrei Vagin , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCH 10/32] x86/vdso2c: Convert iterator to unsigned Date: Wed, 6 Feb 2019 00:10:44 +0000 Message-Id: <20190206001107.16488-11-dima@arista.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206001107.16488-1-dima@arista.com> References: <20190206001107.16488-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i and j are used everywhere with unsigned types. Cleanup and prettify the code a bit. Introduce syms_nr for readability and as a preparation for allocating an array of vDSO entries that will be needed for creating two vdso .so's: one for host tasks and another for processes inside time namespace. Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vdso2c.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/entry/vdso/vdso2c.h b/arch/x86/entry/vdso/vdso2c.h index fa847a620f40..61c8bb2e5af8 100644 --- a/arch/x86/entry/vdso/vdso2c.h +++ b/arch/x86/entry/vdso/vdso2c.h @@ -13,7 +13,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len, unsigned long load_size = -1; /* Work around bogus warning */ unsigned long mapping_size; ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr; - int i; + unsigned int i, syms_nr; unsigned long j; ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, *alt_sec = NULL; @@ -86,11 +86,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len, strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) + GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link); + syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); /* Walk the symbol table */ - for (i = 0; - i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); - i++) { - int k; + for (i = 0; i < syms_nr; i++) { + unsigned int k; ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) + GET_LE(&symtab_hdr->sh_entsize) * i; const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) + -- 2.20.1