From nobody Wed Sep 17 23:47:54 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D133AC4332F for ; Wed, 14 Dec 2022 00:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236984AbiLNAwA (ORCPT ); Tue, 13 Dec 2022 19:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236535AbiLNAv5 (ORCPT ); Tue, 13 Dec 2022 19:51:57 -0500 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003BD55BF; Tue, 13 Dec 2022 16:51:55 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id fu10so1440722qtb.0; Tue, 13 Dec 2022 16:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=agc2D5uYmPBhslvrwBFEjc9DPi+bA6UTLkfJdzaASJc=; b=IRmaO3gTkbp/3ZHH3PwmQ3dcmX2tUXE9ATSXJYxd82SbVNdvwyCcKiVtkLpVFdmZda 3iZRMHIc9o9FPGD+hJroEnSNWflBT6bu1WlCsgF2mLuja5Sw0OqtjXeHjV1fYMkQ+DMT WZDWp9MUQmkDm3ZysJxKeY/5dL4CfSD3bVYiqPLRMapFDGcHGnaL9sUT2YkABzYNDrpK jCrgiGxeycHPgimneAiL6B9nvf8I0nrDH9bYVsJ11popj2wYHO/TEuboSecLf0DE08L6 lRrIoyR8T/B/55eMQDEDtpgyBxBo1w+3NN/5Nf4ZY/Vj2NFEOH0fPvO8ifu2eQUxhCwY mIOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=agc2D5uYmPBhslvrwBFEjc9DPi+bA6UTLkfJdzaASJc=; b=Cc6THhLswfz9Ow1hUHeMl799Mwo9G9hlwgnSAM3jHNf790V7Op2jfrDvKRRnnS+Ota tE2fLZPoyr4Wf0rUPZJH7o5VkxUokKUxdmTeKJMFWST7twvhJslEVAEpSaIIUhRR0x3S VdGsDjy6y6pLmWHD02Rtopt94zqXVvGb8sAdNXqjY7iswFwmO+/305tgbBFKeQ0C9cuZ CAL6nfimxHqZxCOyiuA8fykplgJocS0ENyvcDShuHgoodQ95QX657+enqbbK2XLVY64d 6DBTHyhMTJ+EWhRa1cmGUNdDuOsstwDDVN3tvZdTngxcOvoGwg2DLkPeBACXb4KrZNTY rstw== X-Gm-Message-State: ANoB5pljuj5G9Tb/BJ90woQa0gnwwZ/PGU2t18MM3Lz5Vz50KBC+1o5U IvPkV3wWdO22UXPjzyPD+w== X-Google-Smtp-Source: AA0mqf6xtw54xm0GMZdLZAEzR7nsKOAr/4XmlduLF8bSU3of4o7NGfBAgtwAq1Nc4Ln6pTf7X8o1FA== X-Received: by 2002:ac8:1118:0:b0:3a5:fef7:dfe5 with SMTP id c24-20020ac81118000000b003a5fef7dfe5mr26533804qtj.12.1670979114961; Tue, 13 Dec 2022 16:51:54 -0800 (PST) Received: from ?IPV6:2603:7080:a33a:d95d:20:71fc:7eaf:858a? (2603-7080-a33a-d95d-0020-71fc-7eaf-858a.res6.spectrum.com. [2603:7080:a33a:d95d:20:71fc:7eaf:858a]) by smtp.gmail.com with ESMTPSA id p20-20020ac84614000000b003a611cb2a95sm833107qtn.9.2022.12.13.16.51.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 16:51:54 -0800 (PST) Message-ID: Date: Tue, 13 Dec 2022 19:51:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US To: sstabellini@kernel.org, tsbogend@alpha.franken.de, chris@zankel.net, jcmvbkbc@gmail.com Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org From: Seija Kijin Subject: [PATCH] arch: change variable types to match those of what is assigned to them Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are many places where "int len =3D strlen(foo);" is written, just for= len to be passed as a parameter of size_t. This causes truncation and then= expansion back from int to size_t. Not to mention this is poor logic and n= eedless truncations can add extra unneeded instructions. This patch aims to fix the worst offenders. Signed-off-by: Seija Kijin --- =C2=A0arch/arm/mm/mmu.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= | 30 +++++++++++++------------- =C2=A0arch/arm/probes/kprobes/test-core.c=C2=A0=C2=A0=C2=A0 |=C2=A0 8 +++-= --- =C2=A0arch/arm/vfp/vfpmodule.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++-- =C2=A0arch/arm/xen/p2m.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |= =C2=A0 4 ++-- =C2=A0arch/mips/alchemy/common/irq.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 |=C2=A0 2 +- =C2=A0arch/mips/alchemy/common/prom.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |=C2=A0 2 +- =C2=A0arch/mips/alchemy/devboards/bcsr.c=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 2= +- =C2=A0arch/mips/alchemy/devboards/platform.c |=C2=A0 8 +++---- =C2=A0arch/mips/ar7/prom.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++-- =C2=A0arch/mips/boot/compressed/dbg.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 14 +++++------- =C2=A0arch/mips/fw/arc/cmdline.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++-- =C2=A0arch/xtensa/platforms/iss/console.c=C2=A0=C2=A0=C2=A0 |=C2=A0 4 ++-- =C2=A012 files changed, 41 insertions(+), 45 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..27f5acb69c3b 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -117,7 +117,7 @@ static unsigned long initial_pmd_value __initdata =3D 0; =C2=A0 */ =C2=A0void __init init_default_cache_policy(unsigned long pmd) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0initial_pmd_value =3D pmd; @@ -140,20 +140,22 @@ void __init init_default_cache_policy(unsigned long p= md) =C2=A0 */ =C2=A0static int __init early_cachepolicy(char *p) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i, selected =3D -1; +=C2=A0=C2=A0 =C2=A0size_t i, selected =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < ARRAY_SIZE(cache_policies); i++= ) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int len =3D strlen(cache_policies[i]= .policy); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0size_t len =3D strlen(cache_policies= [i].policy); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (memcmp(p, cache_policies[i= ].policy, len) =3D=3D 0) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0selected = =3D i; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0break; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto no_err; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (selected =3D=3D -1) -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0pr_err("ERROR: unknown or unsupporte= d cache policy\n"); +=C2=A0=C2=A0 =C2=A0pr_err("ERROR: unknown or unsupported cache policy\n"); +no_err: +=C2=A0=C2=A0 =C2=A0if (selected !=3D cachepolicy) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unsigned long cr; =C2=A0=C2=A0=C2=A0 =C2=A0/* =C2=A0=C2=A0=C2=A0 =C2=A0 * This restriction is partly to do with the way = we boot; it is =C2=A0=C2=A0=C2=A0 =C2=A0 * unpredictable to have memory mapped using two = different sets of @@ -161,14 +163,12 @@ static int __init early_cachepolicy(char *p) =C2=A0=C2=A0=C2=A0 =C2=A0 * change these attributes once the initial assem= bly has setup the =C2=A0=C2=A0=C2=A0 =C2=A0 * page tables. =C2=A0=C2=A0=C2=A0 =C2=A0 */ -=C2=A0=C2=A0 =C2=A0if (cpu_architecture() >=3D CPU_ARCH_ARMv6 && selected = !=3D cachepolicy) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0pr_warn("Only cachepolicy=3D%s suppo= rted on ARMv6 and later\n", -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cache_policies[ca= chepolicy].policy); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return 0; -=C2=A0=C2=A0 =C2=A0} - -=C2=A0=C2=A0 =C2=A0if (selected !=3D cachepolicy) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unsigned long cr =3D __clear_cr(cach= e_policies[selected].cr_mask); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (cpu_architecture() >=3D CPU_ARCH= _ARMv6) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0pr_warn("Only cac= hepolicy=3D%s supported on ARMv6 and later\n", +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0cache_policies[cachepolicy].policy); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0return 0; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cr =3D __clear_cr(cache_policies[sel= ected].cr_mask); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cachepolicy =3D selected; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0flush_cache_all(); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0set_cr(cr); @@ -445,7 +445,7 @@ static void __init build_mem_type_table(void) =C2=A0=C2=A0=C2=A0 =C2=A0unsigned int cr =3D get_cr(); =C2=A0=C2=A0=C2=A0 =C2=A0pteval_t user_pgprot, kern_pgprot, vecs_pgprot; =C2=A0=C2=A0=C2=A0 =C2=A0int cpu_arch =3D cpu_architecture(); -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0size_t i; =C2=A0=C2=A0=C2=A0 =C2=A0if (cpu_arch < CPU_ARCH_ARMv6) { =C2=A0#if defined(CONFIG_CPU_DCACHE_DISABLE) diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/= test-core.c index c562832b8627..7e8694eb772c 100644 --- a/arch/arm/probes/kprobes/test-core.c +++ b/arch/arm/probes/kprobes/test-core.c @@ -723,9 +723,9 @@ static const char coverage_register_lookup[16] =3D { =C2=A0unsigned coverage_start_registers(const struct decode_header *h) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0unsigned regs =3D 0; -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < 20; i +=3D 4) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int r =3D (h->type_regs.bits >> (DEC= ODE_TYPE_BITS + i)) & 0xf; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unsigned r =3D (h->type_regs.bits >>= (DECODE_TYPE_BITS + i)) & 0xf; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0regs |=3D coverage_register_lo= okup[r] << i; =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0return regs; @@ -774,12 +774,12 @@ static int coverage_start(const union decode_item *ta= ble) =C2=A0static void =C2=A0coverage_add_registers(struct coverage_entry *entry, kprobe_opcode_t= insn) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int regs =3D entry->header->type_regs.bits >> DECODE_TY= PE_BITS; +=C2=A0=C2=A0 =C2=A0u32 regs =3D entry->header->type_regs.bits >> DECODE_TY= PE_BITS; =C2=A0=C2=A0=C2=A0 =C2=A0int i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < 20; i +=3D 4) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0enum decode_reg_type reg_type = =3D (regs >> i) & 0xf; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int reg =3D (insn >> i) & 0xf; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int flag; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unsigned flag; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!reg_type) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0continue; diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 2cb355c1b5b7..c491ed8e5cf2 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -227,7 +227,7 @@ static void vfp_raise_sigfpe(unsigned int sicode, struc= t pt_regs *regs) =C2=A0static void vfp_panic(char *reason, u32 inst) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0pr_err("VFP: Error: %s\n", reason); =C2=A0=C2=A0=C2=A0 =C2=A0pr_err("VFP: EXC 0x%08x SCR 0x%08x INST 0x%08x\n", @@ -700,7 +700,7 @@ static struct undef_hook vfp_kmode_exception_hook[] =3D= {{ =C2=A0static int __init vfp_kmode_exception_hook_init(void) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0size_t i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < ARRAY_SIZE(vfp_kmode_exception_= hook); i++) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0register_undef_hook(&vfp_kmode= _exception_hook[i]); diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index 309648c17f48..7417da4d1236 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c @@ -92,7 +92,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *= map_ops, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0 struct gnttab_map_grant_ref *kmap_ops, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0 struct page **pages, unsigned int count) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < count; i++) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0struct gnttab_unmap_grant_ref = unmap; @@ -137,7 +137,7 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant= _ref *unmap_ops, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 struct gnttab_unmap_grant_ref *kunmap_ops, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 struct page **pages, unsigned int count) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < count; i++) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0set_phys_to_machine(unmap_ops[= i].host_addr >> XEN_PAGE_SHIFT, diff --git a/arch/mips/alchemy/common/irq.c b/arch/mips/alchemy/common/irq.c index da9f9220048f..83f73ae7d225 100644 --- a/arch/mips/alchemy/common/irq.c +++ b/arch/mips/alchemy/common/irq.c @@ -809,7 +809,7 @@ static int alchemy_gpic_suspend(void) =C2=A0static void alchemy_gpic_resume(void) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0void __iomem *base =3D (void __iomem *)KSEG1ADDR(= AU1300_GPIC_PHYS_ADDR); -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0u32 i; =C2=A0=C2=A0=C2=A0 =C2=A0/* disable all first */ =C2=A0=C2=A0=C2=A0 =C2=A0__raw_writel(~0UL, base + AU1300_GPIC_IDIS + 0x0); diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/pro= m.c index b13d8adf3be4..7b28b9ce1d3a 100644 --- a/arch/mips/alchemy/common/prom.c +++ b/arch/mips/alchemy/common/prom.c @@ -111,7 +111,7 @@ static inline unsigned char str2hexnum(unsigned char c) =C2=A0static inline void str2eaddr(unsigned char *ea, unsigned char *str) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < 6; i++) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0unsigned char num; diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboar= ds/bcsr.c index 8df0ccdc9287..894916e95ff6 100644 --- a/arch/mips/alchemy/devboards/bcsr.c +++ b/arch/mips/alchemy/devboards/bcsr.c @@ -28,7 +28,7 @@ static int bcsr_csc_base;=C2=A0=C2=A0 =C2=A0/* linux-irq = of first cascaded irq */ =C2=A0void __init bcsr_init(unsigned long bcsr1_phys, unsigned long bcsr2_= phys) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0bcsr1_phys =3D KSEG1ADDR(CPHYSADDR(bcsr1_phys)); =C2=A0=C2=A0=C2=A0 =C2=A0bcsr2_phys =3D KSEG1ADDR(CPHYSADDR(bcsr2_phys)); diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/dev= boards/platform.c index 754bdd2ca630..a69d9d56f130 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c @@ -122,10 +122,10 @@ int __init db1x_register_pcmcia_socket(phys_addr_t pc= mcia_attr_start, =C2=A0=C2=A0=C2=A0 =C2=A0i =3D 5; =C2=A0=C2=A0=C2=A0 =C2=A0if (stschg_irq) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[i].name=C2=A0=C2=A0 =C2=A0=3D "st= schg"; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[i].flags=C2=A0=C2=A0 =C2=A0=3D IO= RESOURCE_IRQ; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[i].start =3D sr[i].end =3D stschg= _irq; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0i++; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[5].name=C2=A0=C2=A0 =C2=A0=3D "st= schg"; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[5].flags=C2=A0=C2=A0 =C2=A0=3D IO= RESOURCE_IRQ; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[5].start =3D sr[5].end =3D stschg= _irq; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0i =3D 6; =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0if (eject_irq) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sr[i].name=C2=A0=C2=A0 =C2=A0= =3D "eject"; diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c index 5810d3993fc6..dda3ed6934ac 100644 --- a/arch/mips/ar7/prom.c +++ b/arch/mips/ar7/prom.c @@ -144,7 +144,7 @@ static void __init add_adam2_var(char *name, char *valu= e) =C2=A0static int __init parse_psp_env(void *psp_env_base) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i, n; +=C2=A0=C2=A0 =C2=A0unsigned i, n; =C2=A0=C2=A0=C2=A0 =C2=A0char *name, *value; =C2=A0=C2=A0=C2=A0 =C2=A0struct psp_env_chunk *chunks =3D (struct psp_env_= chunk *)psp_env_data; @@ -171,7 +171,7 @@ static int __init parse_psp_env(void *psp_env_base) =C2=A0static void __init ar7_init_env(struct env_var *env) =C2=A0{ -=C2=A0=C2=A0 =C2=A0int i; +=C2=A0=C2=A0 =C2=A0unsigned i; =C2=A0=C2=A0=C2=A0 =C2=A0struct psbl_rec *psbl =3D (struct psbl_rec *)(KSE= G1ADDR(0x14000300)); =C2=A0=C2=A0=C2=A0 =C2=A0void *psp_env =3D (void *)KSEG1ADDR(psbl->env_bas= e); diff --git a/arch/mips/boot/compressed/dbg.c b/arch/mips/boot/compressed/db= g.c index f6728a8fd1c3..5957f9030e0c 100644 --- a/arch/mips/boot/compressed/dbg.c +++ b/arch/mips/boot/compressed/dbg.c @@ -25,13 +25,9 @@ void puts(const char *s) =C2=A0void puthex(unsigned long long val) =C2=A0{ - -=C2=A0=C2=A0 =C2=A0unsigned char buf[10]; -=C2=A0=C2=A0 =C2=A0int i; -=C2=A0=C2=A0 =C2=A0for (i =3D 7; i >=3D 0; i--) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0buf[i] =3D "0123456789ABCDEF"[val & = 0x0F]; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0val >>=3D 4; -=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0buf[8] =3D '\0'; -=C2=A0=C2=A0 =C2=A0puts(buf); +=C2=A0=C2=A0=C2=A0 char buf[9]; +=C2=A0=C2=A0=C2=A0 size_t i =3D sizeof(buf) - 1; +=C2=A0=C2=A0=C2=A0 for (buf[i] =3D '\0'; i; val >>=3D 4) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 buf[--i] =3D "0123456789ABCDEF"= [val & 0xF]; +=C2=A0=C2=A0=C2=A0 puts(buf); =C2=A0} diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c index 155c5e911723..5b05069fec8f 100644 --- a/arch/mips/fw/arc/cmdline.c +++ b/arch/mips/fw/arc/cmdline.c @@ -47,7 +47,7 @@ static char __init *move_firmware_args(int argc, LONG *ar= gv, char *cp) =C2=A0=C2=A0=C2=A0 =C2=A0while (actr < argc) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0for(i =3D 0; i < ARRAY_SIZE(us= ed_arc); i++) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int len =3D strle= n(used_arc[i][0]); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0size_t len =3D st= rlen(used_arc[i][0]); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!strncm= p(prom_argv(actr), used_arc[i][0], len)) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Ok, we w= ant it. First append the replacement... */ @@ -86,7 +86,7 @@ void __init prom_init_cmdline(int argc, LONG *argv) =C2=A0=C2=A0=C2=A0 =C2=A0while (actr < argc) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0for (i =3D 0; i < ARRAY_SIZE(i= gnored); i++) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int len =3D strle= n(ignored[i]); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0size_t len =3D st= rlen(ignored[i]); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!strncm= p(prom_argv(actr), ignored[i], len)) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0goto pic_cont; diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/is= s/console.c index 10b79d3c74e0..3159917ffd2f 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -64,7 +64,7 @@ static int rs_write(struct tty_struct * tty, =C2=A0static void rs_poll(struct timer_list *unused) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0struct tty_port *port =3D &serial_port; -=C2=A0=C2=A0 =C2=A0int i =3D 0; +=C2=A0=C2=A0 =C2=A0size_t i =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0int rd =3D 1; =C2=A0=C2=A0=C2=A0 =C2=A0unsigned char c; @@ -192,7 +192,7 @@ late_initcall(rs_init); =C2=A0static void iss_console_write(struct console *co, const char *s, uns= igned count) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0if (s && *s !=3D 0) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0int len =3D strlen(s); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0size_t len =3D strlen(s); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0simc_write(1, s, count < len ?= count : len); =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0} --=20 2.38.2