From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790EA37A4AB for ; Mon, 29 Jun 2026 02:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782701107; cv=none; b=FTQOURLvR9rkg1j0w+V6sfY5pu0gKmx415/7PpygP9nlWXvuL7t5MG8k7EAwkCMdFsD5SixpQNiksX3GvwPNOWJ1MmwUtAzWsd7YEep6GLlMDt13JvxL1U+k8Y8arIt+PkbpeaBsA/Z5sNPMMWzygodMjpvekGnaNQHFeaoa1CU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782701107; c=relaxed/simple; bh=eyz1AEVqoS4Uuz3rPco8ZC+WEO4OHjLjMWMaVrQTUPk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HbP8vTYPhjhUBmsWQcVSZD7lUxdVFGtsziPj6Ir8B3wswFbGdn9T6OUXQYwXHasFjNqPu4hDvaJ3BXSE7xm+XMVw0BaxiDAVC+w6u3i7Nv+9jdPQZbgKfgkoEDtlXcAOJ+QpdR86O4moZf3kJ8Vgn6CCxAJnpqBfgwdCrKjbw1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=PPe5SU3h; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="PPe5SU3h" Date: Mon, 29 Jun 2026 10:44:54 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782701103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=24pcIPxMD0v6nE+cG+HmVJw2coOQJ/tv1WIShhEM0FM=; b=PPe5SU3h4MEEiLPUe/QzJU9PR0czyQkxI+pjm3N25zVWI5VhQns/QCg+HAn+ZT+h18mwqS 52NcGNqgtJ/o0T5PScjra6RZ5YJuZDse42+o2h6SByl9Ua8bD4l8DLWdEZN4NpaLeeD62M dAZ9KM+CXxCQidcZHmdrwL1+qVnprbs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Baoquan He To: Tao Liu Cc: Baoquan He , kexec@lists.infradead.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: Fix a NULL pointer reference in machine_kexec_prepare Message-ID: References: <20260529032739.13264-2-ltao@redhat.com> 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: X-Migadu-Flow: FLOW_OUT On 06/28/26 at 10:38am, Tao Liu wrote: ...... > > > /* > > > * Some segments (e.g. IMA) reserve space but have no buffer > > > * loaded yet. Skip them as they cannot contain an FDT. > > > */ > > > And is there any other place where the similar issue exists? e.g on LoongArch? > > I have tested in LoongArch, it doesn't have the similar issue. The > reason is, in arch/loongarch/kernel/machine_kexec.c:machine_kexec_prepare(), > the unchecked memcpy() only happens for none kexec file load, however > ima_add_kexec_buffer() requires kexec file load. So the condition > isn't met. OK, that's good, thanks for the effort. > > > > > > > Other than above concerns, this patch looks good to me: > > > > > > Acked-by: Baoquan He > > Thanks for your code review and suggestions! > > Thanks, > Tao Liu > > > > > > > > > if (image->file_mode) > > > > > memcpy(&fdt, image->segment[i].buf, sizeof(fdt)); > > > > > else if (copy_from_user(&fdt, image->segment[i].buf, sizeof(fdt))) > > > > > -- > > > > > 2.47.0 > > > > > > > > > > > > > > > > > _______________________________________________ > > > > linux-riscv mailing list > > > > linux-riscv@lists.infradead.org > > > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > > > > > > >