Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6557903rdb; Tue, 2 Jan 2024 06:03:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwaxh4ro6nLNz1gaEU6pCA5Gc27ABHYUmodhC3CjBZkLFjdKgdAnbsee4Klqq+rXSo0nWs X-Received: by 2002:a05:600c:b45:b0:40d:8369:654e with SMTP id k5-20020a05600c0b4500b0040d8369654emr1507884wmr.6.1704204205128; Tue, 02 Jan 2024 06:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704204205; cv=none; d=google.com; s=arc-20160816; b=HQULixH3DUZFce8TAS2h2LncPkTZd1/WBy3Zm3y/EZXdA7Exf+Mo52I/vSqjlegHkj Fq+MTzwcjpNuixd2HhrRoZBEWsVByZEp/y6uTK5VjC4bbec6ShnGqyC542XSf4gPW3E0 NofzUt2yWGZs+Iew09dWjTYv9a1dviuuQGqlTSEXv+noTHdSvRki0wulDxmY/C60BMax DGHI2Xegof6Dpztbqin59c7zHP4lvfxSt7zKVavvnEZS7JfbiQwn+UavksozwX3xH0Gv 6rR3sOmfVVdB9QNTGeYD1fbgvQMkJh5TKyBLs//dMtg324wKlnTYM1w0SxIQ5a6elzGt VF0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=euPFm6DrMI0+wW/k92PU5TU57T+pTbdKKdKloQ0vt4M=; fh=ql96xKy1rOfUvb11k09PSjVcqpdFdhqwMDOJUIshHjU=; b=hRlYZrQ8rmC36EL47cQmhEre8voHGERV0YfsQf/5gr7/WSfoCwPKF/zhuvOZexKgvE Y3JjTUBtXtGFqrtOAwap/Z0ZXGC5CjrVbW0ggff9vxfjpmqPGoro0yi8mNFQO2Zyo65r NCCDdmQZiSBe5VJ4b75lNeeah3eW0cERzyMW09V1yl/CZrSNY04c0KddWwhEq3Sy4pnu NWRdrb6cksvgO9DXqFIxGGAAyjImYMz9jWAsOZiiPrMD1ExXR5l1UX32fRNfon/6jhYN hVJZQ/MEQBDsssXqL7aMOLA/VieEY1ekYsZylw2ifDtBWBhWG83ZUy61LUNDFxMKHl3p Lw9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjBFpDQn; spf=pass (google.com: domain of linux-kernel+bounces-14452-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14452-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gi34-20020a1709070ca200b00a1d3eccb0f0si9993518ejc.428.2024.01.02.06.03.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 06:03:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14452-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjBFpDQn; spf=pass (google.com: domain of linux-kernel+bounces-14452-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14452-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DCF141F22BF9 for ; Tue, 2 Jan 2024 14:03:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDA1D101C3; Tue, 2 Jan 2024 14:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fjBFpDQn" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE50812E59 for ; Tue, 2 Jan 2024 14:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33723ad790cso3028931f8f.1 for ; Tue, 02 Jan 2024 06:03:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704204193; x=1704808993; 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=euPFm6DrMI0+wW/k92PU5TU57T+pTbdKKdKloQ0vt4M=; b=fjBFpDQn+rKpd5C0IyqZHp+wzfjeQfH/sm80HwSjWUpHz/zAGqamLC+eZ8cmEGQv9p O2yjMBNHcTsn5hUx7SIz2nW9YIHYczJYqd/OfKkgtXYXGMy/dfE084BcpyYckX8eTVHs w13ThAQLkrQ7tGysu4LH926feFHL7UkcjyEPGRm8QptKB4iOyGhMqFRVZ8ULHsBFmmH5 fhGy5Ids+3dQwY919aX2pUMKGQ7TP7pvzQ9+j1oMD7LKG54xy5puno0uaMeE+qEZXOmI LxCpR1u5xS/lg/YyaYc+LnwkMzSy5VCyGe4PRGeDu7DS2tmikhCfRST9BKC2i3KeGh1r JDrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704204193; x=1704808993; 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=euPFm6DrMI0+wW/k92PU5TU57T+pTbdKKdKloQ0vt4M=; b=nlzIEx2VThQ/l3Adp8kB6bbZoHJUqvKdUsoBoHORPpEPq7XBGY97cLr+EyzK7XOlnT OcUeqpRZ8zjTb9KMJej6qv0Kpz1MJfvG/KMSdcc6mAG/QVHCDVezBwXWgqX8yYEN7XSU 31AjO4PjAr1LGMjOwF/L8uzYFj3FATtw++XgzcTJ4dzZ+8pN30gBsyFtzUaMtQq4n+CF GG0yeG8hoLmSGE4OhK3sQ776AnHmrcbq+N8bOu8lgAKFUNiMz4++MDdTyAFCqddzaKHa +gchbBvM+uP+cWjZu9hUl52wmGDCr1uDz4CgHnQ3eKrWcEUC5rlbijXciGFhoDzVMJ/q TwvQ== X-Gm-Message-State: AOJu0Ywoq0X2uxPJma15PvXWja7Q9W1tYxVzhZDDG9rviKzfarv/KI49 71GjodHmyK3cYEy3GuWnkbUhDyVP7nwoxg== X-Received: by 2002:a05:600c:4f54:b0:40d:8580:4f1a with SMTP id m20-20020a05600c4f5400b0040d85804f1amr1443638wmq.171.1704204193127; Tue, 02 Jan 2024 06:03:13 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id c18-20020a05600c0a5200b0040c6d559490sm45398508wmq.3.2024.01.02.06.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 06:03:12 -0800 (PST) Date: Tue, 2 Jan 2024 15:37:34 +0300 From: Dan Carpenter To: Charlie Jenkins Cc: oe-kbuild@lists.linux.dev, lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Palmer Dabbelt Subject: Re: arch/riscv/kernel/module.c:639 process_accumulated_relocations() error: uninitialized symbol 'curr_type'. Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Dec 27, 2023 at 04:59:25PM -0800, Charlie Jenkins wrote: > On Thu, Dec 14, 2023 at 11:00:46AM +0300, Dan Carpenter wrote: > > On Wed, Dec 13, 2023 at 11:27:02AM -0800, Charlie Jenkins wrote: > > > > 8fd6c5142395a1 Charlie Jenkins 2023-11-01 638 } > > > > 8fd6c5142395a1 Charlie Jenkins 2023-11-01 @639 reloc_handlers[curr_type].accumulate_handler( > > > > ^^^^^^^^^ > > > > Can the list be empty? Uninitialized in that case. > > > > > > That's a tricky one, the list cannot be empty. Each bucket in the > > > bucket_iter is guarunteed to have at least one rel_entry. I can probably > > > resolve this by extracting this for loop into a do-while loop. > > > > You can just ignore false positives. It's not really a fix to change it > > to a do-while loop. I reviewed the do while code before reading this > > email and I still wondered about empty lists, but just to hear that it's > > not going to be empty is enough. Just the email was sufficient. > > > > regards, > > dan carpenter > > > > The fix isn't the do-while loop but rather the use after free, the > incorrect sizeof, and incorrect error handling when > initialize_relocation_hashtable fails. I decided to include the do-while > code because I was already touching the surrounding code. Can you review > [1]? If you would prefer that the do-while is reverted, I can do that, > but it is important that the rest of the fixes are merged before 6.7 is > released. > > [1] https://lore.kernel.org/all/20231213-module_loading_fix-v1-1-da9b7c92ade5@rivosinc.com/ Most subsystems wouldn't merge a patch like this which does so many things at the same time... regards, dan carpenter