Received: by 2002:a05:7208:c250:b0:86:f851:443 with SMTP id w16csp49005rbd; Tue, 11 Jun 2024 12:39:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmEL/jdCj2OnZIFDYgJ9wm8ddRx0EOEpi9x3o8gNQq3SuVe+Zdp/TBDS+tDGXjDSPAuG3CuS4fwkvBa5Tw4sMz3WwDjIXAm6Q41scqMw== X-Google-Smtp-Source: AGHT+IHhd1/h9dJzoq3YCGUGnd+iKI7hIhpJP4hfbWqDE85LJXvGwexIYa6wRcXfwmCOgEZZZEHU X-Received: by 2002:a05:6808:1401:b0:3d2:1e2b:e228 with SMTP id 5614622812f47-3d21e2c2c23mr13341230b6e.17.1718134752321; Tue, 11 Jun 2024 12:39:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718134752; cv=pass; d=google.com; s=arc-20160816; b=OfAcIe/eGi2iZ7avHlUem2v/+EU7EC0KtLThsd2tGqUNNrfKrQWAY+U5LTAoCYpzn3 GTCrgwLQghuDcbJjbqrlisKzi/VnA2o6TZglt19JOr0rZ3PjVZqNnOGEctxl6jbwuw9g ML95yyV2wEC41RDJPb9cUxNIYIL3hh3uvfC9uXN5NPPzGvWei+7Ly/G1TkGi5AI1rmZi dZIlV6++WKDsXNfT8PERemEVsqCQZECDhRA1diRrUQg5Ws3iLrvonLHKUVhHlVJ+h0ai rF/4qYbNkfIn3v7/Z9LAIxlB/uejJzYn5lRsSdXQUxAChJma/KEH8jJvmA7gM6qcWlVs dqDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=EsCfcZ4MKl2tNfeh78Jv4sokZSesflPs+tenRCc7XAQ=; fh=dVhZfHRbgc09+OIZzK7+Dbg7ckoy+986xM9UGaoG3Mw=; b=kNy5ONb3JjSSRo82HHlKr449VelzX6J/41kEFXjMuy6uZw6h2Xs/WSn7j4AEW8uIVW J427kNVshGyA2lW9/NJLDw38tN3P0OwMhgEaj991zWARJvSpk6SHyz6N22IlleTkDVJH 8uchWFZwA4IVaOYUVq4gbZG9/HwUnMT029FN9eWme+/N15T+hTgDhnL//C2NE6xhSZBG VBllrbAp7nWGpQnmos7zbJh6L8ZxIWU0K8jICQOPyVqYkMSzaH4Rz1DDaJBFsLG1TX0S lzFFzW6drCPnQm/3UUXWhu8P8guydx3rDRDjT22msEghjniSfnb+cgroDAcZay3eu2IE qrdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210520-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-440461c0ccbsi114855901cf.630.2024.06.11.12.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 12:39:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210520-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210520-linux.lists.archive=gmail.com@vger.kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 138851C229D7 for ; Tue, 11 Jun 2024 19:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26162140E30; Tue, 11 Jun 2024 19:39:02 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 94F0C84A21; Tue, 11 Jun 2024 19:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718134741; cv=none; b=ukkKTwVYcfUVR+1/QqWfy1xbF+JbaZxaVy7yr/OutacfZDE2jqZnSYhixi77yExUmrZrpZ6t4pYH3KLlS6VJHWjEe9m5RtFHBjStxa3TBB5pDBji8cGWUi+KZ/x+CC5ee/81vqpeO1t1roTSeiyE04hzE6r/ncGmuS8LRW+OZ5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718134741; c=relaxed/simple; bh=w2c2G6obsMPgsfkn18lzhEJVlZV+GkjZQ8kXfu4gBA4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HkoAlpo9ANDI9xZQpOCwI88EZm6X9V9KrqJm7pg9hQJyq6IkW+248wTp9ToFyk2lsipYJgSIFqXWfbS7ZHWhLiYWmHG3u8YKEHLbKUj/0usROwRH9Tcv6VkfCjCTS2nHjz4F2vKaeVvKB9CvZmA5HAErFob1sMKfk5rwew4FA54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7AE7C4AF48; Tue, 11 Jun 2024 19:38:57 +0000 (UTC) Date: Tue, 11 Jun 2024 15:39:13 -0400 From: Steven Rostedt To: Wei Yang Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , linux-hardening@vger.kernel.org, Guenter Roeck , Ross Zwisler , wklin@google.com, Vineeth Remanan Pillai , Joel Fernandes , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon , Ard Biesheuvel , Mike Rapoport Subject: Re: [PATCH v2 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up Message-ID: <20240611153913.1568be52@gandalf.local.home> In-Reply-To: <20240611111218.71e57e0f@gandalf.local.home> References: <20240606150143.876469296@goodmis.org> <20240606150316.751642266@goodmis.org> <20240611144029.h7egl4aif5mjlrwf@master> <20240611111218.71e57e0f@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 11 Jun 2024 11:12:18 -0400 Steven Rostedt wrote: > > >+ p++; > > >+ err = reserved_mem_add(start, size, p); > > >+ if (err) { > > >+ memblock_phys_free(start, size); > > >+ return err; > > >+ } > > >+ > > >+ p += strlen(p); > > >+ > > >+ return *p == '\0' ? 0: -EINVAL; > > > > We won't free the memory if return -EINVAL? I actually copied this from parse_memmap_one() in arch/x86/kernel/e820.c and now looking at it, it's a pretty stupid check. It does: p += strlen(p); which requires p ending with '\0'. So this will likely bug if there is no '\0'. I'm going to remove this, but still check to make sure that the name has some length before the allocation. -- Steve