Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp693348rdb; Thu, 19 Oct 2023 17:05:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEo0zp6ihRrUlRwOt/4fVfdpD0EaxblKnIPRiZ3eT+v11yozZby4kSjWTC5Vx0KImL+G2R/ X-Received: by 2002:a05:6808:10d0:b0:3b2:f2e0:1ecd with SMTP id s16-20020a05680810d000b003b2f2e01ecdmr518912ois.4.1697760331947; Thu, 19 Oct 2023 17:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697760331; cv=none; d=google.com; s=arc-20160816; b=mQSi8Y5j4hw/FoQ6QFOeTk08YfNmQ/P6afGDERyzgvX14Ry8yCXvBYNSmtK6QHWyXZ 8wyv1JOFWYLUDJS+/05UHq+M9EujzGjGUeVjo0K4y8q3nR21D0sS+3WsxRO8kU5qRfWY SQhR8WO2SjNZfJ40lEjjdZ7+/FVPhXDJTHR00jPWxuqRhVjQp6XX+ktZvS5Iu1keP8Cv 8dGbv+AjwqxW/cw8Cmi8BbqqkigOoKNGKAtcLZVQUGpl0i2JyhVHIwuie1ooKG47OXwZ Ycd+p8hJWdkf05wk/n4KfIuEFUnywIRAeB4BKLkjt9+da2kdtpf7y+VovJKXAlDpqDLc TKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RZE3cc6e0ypcAqaFcINIc2gZj+EhE8lhjLqWQSkY/ho=; fh=RH1Vzlt2kn6tm0f518stxZLXWSSJT7H5ASP7iMceuSc=; b=GiAglY0nkDmkx02hIEyHMfEhXZ2GLae1D8xSePfNFlRcD8Vc0gIMMBN7LusbvQSmft C2AP1H26zM13k/mgdKR/fjcxfhZkQrS2P0Mw0KJQpOW67RYA5R78Yj8y01/pRDwZJtPD J2ss+E2gQC1VkT/iWZuL1koO22ThwpdkIeSaCIq7VkieZg/RP86cG6yyvRseWR2Tq3CC B9a0Ig4LvYJDVYrEN2zPW+OqiAjJE47f0tFLhJ12R2Pr0BuKTHISC24gc8WkDU90lZfC 4ujHDCMuQkK9y6c49vJPpIdmIkBsedAUp70FO13Lh58Un10++97W7JF/JyA7OVW8ZZUM 10Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=mztIr8pN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id h131-20020a636c89000000b0058988dc95cfsi647701pgc.463.2023.10.19.17.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 17:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=mztIr8pN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2A4AA83C7586; Thu, 19 Oct 2023 17:05:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346754AbjJTAEi (ORCPT + 99 others); Thu, 19 Oct 2023 20:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346721AbjJTAEh (ORCPT ); Thu, 19 Oct 2023 20:04:37 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE6C181 for ; Thu, 19 Oct 2023 17:04:34 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d9ac31cb051so266583276.3 for ; Thu, 19 Oct 2023 17:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1697760273; x=1698365073; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RZE3cc6e0ypcAqaFcINIc2gZj+EhE8lhjLqWQSkY/ho=; b=mztIr8pNp6Epy4koEz62Tsg5/XZHiYPUUGt/Zj3yNUjTeIu2XCyrH3vhxZo9vo/Z+D Gsgj5HUa3dv4ISEOwsq9gfcUko1TxBwdeWlbgGUkxrpG6L9ObOyCng3zGfp2kzLioedl K67KNCK3IXmY1f+iksdSM6WP6nM0OuhpwYHzAv3byl0JQUj5V5BLV/FbpqynRZ9qEY9L XFGRCaqVc2aMDWM1PeGe6wGqf9EKSu/+i136EUmv5ZAEV5NTE/Qb8ozrKvQAu0r2aBqN cUzVyQcW4QFoDc6M+nr0+mknYLbhuGpr6pVpro5QDWFoccqO8uYJy6gIR1/B68YS0OVL B5jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697760273; x=1698365073; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RZE3cc6e0ypcAqaFcINIc2gZj+EhE8lhjLqWQSkY/ho=; b=VmiG8yKHwh6eMsnTs2RLrIc3iSaTJZvH/BQ7+3L/j4ExYDGoqAhQC/iBI4CrMMGAno juOuBDHCtc5hBflBlbb81tIrUQFIyHyI4bh0cHK62nvqHK72f0ITmq6NROjWR8e0aDl6 85/Q+mwUrhmXnLCLCbh/Rk6ICgray5AjqO9a0C838Gbx6ixzI4zqwIbotdi/hvUik4VD steS+z4MIC6DEwPnpg7uZZcWtRaUqcE0wu5D+ZvT0iHe4pMd0bNtnvwbpQZDaOIL9Taj QWu3olxbDgwKAnFnuudNcOUoNDjaJlgw9X8/uXf9nPoqTxpPnO4SiIciDT7leI1Jnp5W G+FQ== X-Gm-Message-State: AOJu0YxHkqKxhybYLfUd5Eazgphz65AbPRJVd/mlxII66Wdttgf6ntft YHzYaKlQSdU5QBap7bmcGrMfoQ== X-Received: by 2002:a25:d650:0:b0:d9b:e407:663f with SMTP id n77-20020a25d650000000b00d9be407663fmr366426ybg.15.1697760273484; Thu, 19 Oct 2023 17:04:33 -0700 (PDT) Received: from ziepe.ca ([12.22.141.131]) by smtp.gmail.com with ESMTPSA id p85-20020a254258000000b00d7e339ada01sm173990yba.20.2023.10.19.17.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 17:04:32 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qtd0A-003Fme-A9; Thu, 19 Oct 2023 21:04:30 -0300 Date: Thu, 19 Oct 2023 21:04:30 -0300 From: Jason Gunthorpe To: Bob Pearson Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: drivers/infiniband/sw/rxe/rxe_mr.c:106:9: warning: array subscript 0 is outside array bounds of 'struct sg_table[0]' Message-ID: <20231020000430.GE691768@ziepe.ca> References: <202310192300.lurP44yG-lkp@intel.com> <57edd968-91d7-41f9-8a29-e86d8f583efa@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57edd968-91d7-41f9-8a29-e86d8f583efa@gmail.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 17:05:29 -0700 (PDT) On Thu, Oct 19, 2023 at 11:22:00AM -0500, Bob Pearson wrote: > On 10/19/23 10:33, kernel test robot wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > head: dd72f9c7e512da377074d47d990564959b772643 > > commit: 592627ccbdff0ec6fff00fc761142a76db750dd4 RDMA/rxe: Replace rxe_map and rxe_phys_buf by xarray > > date: 9 months ago > > config: sparc-randconfig-c023-20211015 (https://download.01.org/0day-ci/archive/20231019/202310192300.lurP44yG-lkp@intel.com/config) > > compiler: sparc64-linux-gcc (GCC) 13.2.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/202310192300.lurP44yG-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/202310192300.lurP44yG-lkp@intel.com/ > > > > All warnings (new ones prefixed by >>): > > > > drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_mr_fill_pages_from_sgt.constprop': > >>> drivers/infiniband/sw/rxe/rxe_mr.c:106:9: warning: array subscript 0 is outside array bounds of 'struct sg_table[0]' [-Warray-bounds=] > > 106 | __sg_page_iter_start(&sg_iter, sgt->sgl, sgt->orig_nents, 0); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > cc1: note: source object is likely at address zero > >>> drivers/infiniband/sw/rxe/rxe_mr.c:106:9: warning: array subscript 0 is outside array bounds of 'struct sg_table[0]' [-Warray-bounds=] > > cc1: note: source object is likely at address zero > > > > > > vim +106 drivers/infiniband/sw/rxe/rxe_mr.c > > > > 98 > > 99 static int rxe_mr_fill_pages_from_sgt(struct rxe_mr *mr, struct sg_table *sgt) > > 100 { > > 101 XA_STATE(xas, &mr->page_list, 0); > > 102 struct sg_page_iter sg_iter; > > 103 struct page *page; > > 104 bool persistent = !!(mr->access & IB_ACCESS_FLUSH_PERSISTENT); > > 105 > > > 106 __sg_page_iter_start(&sg_iter, sgt->sgl, sgt->orig_nents, 0); > > 107 if (!__sg_page_iter_next(&sg_iter)) > > 108 return 0; > > 109 > > 110 do { > > 111 xas_lock(&xas); > > 112 while (true) { > > 113 page = sg_page_iter_page(&sg_iter); > > 114 > > 115 if (persistent && !is_pmem_page(page)) { > > 116 rxe_dbg_mr(mr, "Page can't be persistent\n"); > > 117 xas_set_err(&xas, -EINVAL); > > 118 break; > > 119 } > > 120 > > 121 xas_store(&xas, page); > > 122 if (xas_error(&xas)) > > 123 break; > > 124 xas_next(&xas); > > 125 if (!__sg_page_iter_next(&sg_iter)) > > 126 break; > > 127 } > > 128 xas_unlock(&xas); > > 129 } while (xas_nomem(&xas, GFP_KERNEL)); > > 130 > > 131 return xas_error(&xas); > > 132 } > > 133 > > > > Jason, > > Can you make sense out of this? The marked line (was 106, now 101) > seems completely innocuous. I think this is the key: > > cc1: note: source object is likely at address zero So something is wrong with the call chain passing sgt into this function, at least the compiler thinks it is an empty allocation. Jason