Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30977675rwd; Thu, 6 Jul 2023 13:41:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlG8XQrr3HHtUG2P4igMhx/K06+koxcsNpg8bo+lH2EG44fpfaz1gaGssp67XV31gr73MEzd X-Received: by 2002:a17:902:e54b:b0:1b8:8dab:64e8 with SMTP id n11-20020a170902e54b00b001b88dab64e8mr2448928plf.36.1688676085132; Thu, 06 Jul 2023 13:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688676085; cv=none; d=google.com; s=arc-20160816; b=04KgYxAofdDIujrFpPZB+FEB8PoEHSvj6/HkX3EaGjyKxNwd58fkmH4Y8Ai+FUdZON WOQ2kHR27qn1JTx4li/KN0YskR6aACosGN4T1mvdSvS4Cv+Wbozi3JIe3TkYrwIkBQ6/ a2Q31N9r9PZ2XS4cg4epvyPPf27PzPqmuuk9D5bmL53ECWCQ2KVmHNdkC8ShRZFA48tn iZvIMsfy184KzPPidg+vkEKdNx6JJukOleVs8lVl3NjZ4FUb6TeBHrVa0ZmBYf87V4sf 3F5SjZHzdBli9JyQELaz674o08sB4uLma83YJq6Cp2M6tg8GcbcphMOtSyaocrmo+u7O uCEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=s4yBoBqkuHHLErDtkRA95ZESYPLO0uJaqPBtH9i1rZ8=; fh=Ab4oGi3v1hkSq19Ar5IwLwG/ZWn3z6ipZDgqFpc5neM=; b=B0YaZfDQQo2Eb440hzLqRGHEGXLErNiBp1s2OHt4oyFOlOI9sVcbTY7xOsVVCF+EiD ZIhkbjNLjluPillp2tZz90Ru7JozYY1gLB3rlNJb3Zs6Ey4MvTmmAc/ClZRhg38zADFK LKdQOUFNahMYo3cL0CMoYv9FLIKhf9LpWkNjN1C+/agy3EZKSZ0yMVeeZLKshYy3tCmJ MkObTCH48GHxKmSJDUuBH2PIm2Z/aTCAuCrWcd2XuW/GY1QtWSVfJczH0SSXeZ9eAE01 AJ7BDDI3bk5UKLXNZGskDAPNT0TZyZuwl43in9maDUpxLCc2qBmG7GErVAFY2cCqwF0F 64ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="5ymwnM/O"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a170902c94600b001b8ac8008a4si2131275pla.598.2023.07.06.13.41.13; Thu, 06 Jul 2023 13:41:25 -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=@google.com header.s=20221208 header.b="5ymwnM/O"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232736AbjGFU3A (ORCPT + 99 others); Thu, 6 Jul 2023 16:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232620AbjGFU2r (ORCPT ); Thu, 6 Jul 2023 16:28:47 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 527B22680 for ; Thu, 6 Jul 2023 13:28:21 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-57764a6bf8cso14565457b3.3 for ; Thu, 06 Jul 2023 13:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688675301; x=1691267301; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=s4yBoBqkuHHLErDtkRA95ZESYPLO0uJaqPBtH9i1rZ8=; b=5ymwnM/O8Ja1dLTg3DB062DnzPPpFoyt0ETRRP2xJ7Fv+9QGvqvLsD8oMR3Jv+odcj dXylo65QtsPONwBTRY77rZ/45p59Ycft2Hy3vL+EiipUT333yaWi50IzEtuVMcbA7mB+ B3W6yW9Y5YTZgtMZQSHwc+rg3uWfF1RFPcmcSGXWGCNGyNiV38pIiQMmOcS9j2y1WQJn 5t7l+9/flq1Towc0bgq1dKQr5R1GN3uy+5g/84Gz+H1xPs3TIxzC6FpmZCLG79WyrmiC 45ogGOAkSVGyp5YPwbPqbwB8fg2AMUPJKjyufVLUi56aZs1q//oGUiZru9mtYtBc46ej e/yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688675301; x=1691267301; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s4yBoBqkuHHLErDtkRA95ZESYPLO0uJaqPBtH9i1rZ8=; b=AVRb0vUHO4Un7qLouR0WJpLrtJFq2NP/fqp3otcaCXiUhbCbcFSMJTMb0nbVj9K9rF CWvOfO/Ju+YafUgmAvo8WvIz4PG4ZoG8nL2P4ghL/jd72hokI+3rbIjJ4qoLIBtzvxfc 450Fy6OJgjh2QNQ1Rn91wTqvRDZpHRTfbS12A+6vAhMxM2HH0quqp/9D3br5IXKbg7bd TBAHV+y7EvAZqwk0b/CzS3IgDNhcSV6isMZfEYlvC8a6qXSsAdwAx/cMkx/CmZ7wg0LL IDDWemEjj86blIpY/WJgBAYFWiOYa5hjhk7n7PDqjMEN/vsmXhxetCQx8vFEO5/0LMDk YNQg== X-Gm-Message-State: ABy/qLZxEithCRBrsuNU0bmeyQrb4Vp9H+gVbUO2y3bj5K0woCFfoRQ0 tfB/IJ2nv1DtpwQUJPctSxVekg== X-Received: by 2002:a0d:e6c6:0:b0:56f:f40f:9414 with SMTP id p189-20020a0de6c6000000b0056ff40f9414mr3238504ywe.38.1688675300749; Thu, 06 Jul 2023 13:28:20 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id s4-20020a817704000000b0057a5302e2fesm373645ywc.5.2023.07.06.13.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 13:28:20 -0700 (PDT) Date: Thu, 6 Jul 2023 13:28:11 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Geert Uytterhoeven cc: Hugh Dickins , linux-m68k@lists.linux-m68k.org, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Andrew Morton , Linux Memory Management List Subject: Re: arch/m68k/include/asm/mmu_context.h:164 load_ksp_mmu() warn: unsigned 'mmuar' is never less than zero. In-Reply-To: <202307061849.rJKwVbXb-lkp@intel.com> Message-ID: <11ff8d26-8dbb-6d3a-c488-fd357098414@google.com> References: <202307061849.rJKwVbXb-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Hi Geert, On Thu, 6 Jul 2023, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: c17414a273b81fe4e34e11d69fc30cc8b1431614 > commit: e67b37c368b7cc24b8c0fe5ab6c44422312eab37 m68k: allow pte_offset_map[_lock]() to fail > date: 2 weeks ago > config: m68k-randconfig-m031-20230706 (https://download.01.org/0day-ci/archive/20230706/202307061849.rJKwVbXb-lkp@intel.com/config) > compiler: m68k-linux-gcc (GCC) 12.3.0 > reproduce: (https://download.01.org/0day-ci/archive/20230706/202307061849.rJKwVbXb-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: https://lore.kernel.org/oe-kbuild-all/202307061849.rJKwVbXb-lkp@intel.com/ > > New smatch warnings: > arch/m68k/include/asm/mmu_context.h:164 load_ksp_mmu() warn: unsigned 'mmuar' is never less than zero. > > Old smatch warnings: > arch/m68k/include/asm/mmu_context.h:114 load_ksp_mmu() warn: always true condition '(mmuar >= (0)) => (0-u32max >= 0)' > arch/m68k/include/asm/mmu_context.h:140 load_ksp_mmu() warn: always true condition '(mmuar >= (0)) => (0-u32max >= 0)' > > vim +/mmuar +164 arch/m68k/include/asm/mmu_context.h > > 92 > 93 static inline void load_ksp_mmu(struct task_struct *task) > 94 { > 95 unsigned long flags; > 96 struct mm_struct *mm; > 97 int asid; > 98 pgd_t *pgd; > 99 p4d_t *p4d; > 100 pud_t *pud; > 101 pmd_t *pmd; > 102 pte_t *pte = NULL; > 103 unsigned long mmuar; > 104 > 105 local_irq_save(flags); > 106 mmuar = task->thread.ksp; > 107 > 108 /* Search for a valid TLB entry, if one is found, don't remap */ > 109 mmu_write(MMUAR, mmuar); > 110 mmu_write(MMUOR, MMUOR_STLB | MMUOR_ADR); > 111 if (mmu_read(MMUSR) & MMUSR_HIT) > 112 goto end; > 113 > 114 if (mmuar >= PAGE_OFFSET) { > 115 mm = &init_mm; > 116 } else { > 117 pr_info("load_ksp_mmu: non-kernel mm found: 0x%p\n", task->mm); > 118 mm = task->mm; > 119 } > 120 > 121 if (!mm) > 122 goto bug; > 123 > 124 pgd = pgd_offset(mm, mmuar); > 125 if (pgd_none(*pgd)) > 126 goto bug; > 127 > 128 p4d = p4d_offset(pgd, mmuar); > 129 if (p4d_none(*p4d)) > 130 goto bug; > 131 > 132 pud = pud_offset(p4d, mmuar); > 133 if (pud_none(*pud)) > 134 goto bug; > 135 > 136 pmd = pmd_offset(pud, mmuar); > 137 if (pmd_none(*pmd)) > 138 goto bug; > 139 > 140 pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar) > 141 : pte_offset_map(pmd, mmuar); > 142 if (!pte || pte_none(*pte) || !pte_present(*pte)) > 143 goto bug; > 144 > 145 set_pte(pte, pte_mkyoung(*pte)); > 146 asid = mm->context & 0xff; > 147 if (!pte_dirty(*pte) && mmuar <= PAGE_OFFSET) > 148 set_pte(pte, pte_wrprotect(*pte)); > 149 > 150 mmu_write(MMUTR, (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | > 151 (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK) > 152 >> CF_PAGE_MMUTR_SHIFT) | MMUTR_V); > 153 > 154 mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) | > 155 ((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X); > 156 > 157 mmu_write(MMUOR, MMUOR_ACC | MMUOR_UAA); > 158 > 159 goto end; > 160 > 161 bug: > 162 pr_info("ksp load failed: mm=0x%p ksp=0x08%lx\n", mm, mmuar); > 163 end: > > 164 if (pte && mmuar < PAGE_OFFSET) > 165 pte_unmap(pte); > 166 local_irq_restore(flags); > 167 } > 168 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki I'm sorry, it appears that I've increased the number of smatch warnings on m68k: but since it was already complaining about "mmuar >= PAGE_OFFSET"s there, I'm not going to feel very guilty about my "mmuar < PAGE_OFFSET"; and I've no idea of the significance of PAGE_OFFSET 0 on m68k. Over to you - but I expect ignoring this will continue to be the right answer :) Thanks, Hugh