From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 63BCA212D6E for ; Fri, 10 Jan 2025 16:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736527323; cv=none; b=ZYQLwXRnkm0l9MUJnl9luGykx/beYh4cWgv+yt3FmLsWw9ioW1E0NmUmZzQmwq92WGEhsgIw4gcuUKaqYvfi/pWOxyEnP0CKkn+tf8hI77e/VBefU8cNR/eyVf3ahBMzOudjbF4Q7bPf10GhTKuGbtWQsw3aeR2ZrooMxxhV/8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736527323; c=relaxed/simple; bh=l7rjr3COSFBP/bMDidfMGCSJ4N9Dp7+wrH0L50ZNRfM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T6OAcZW6SzpkAfZDGR5dokc7nqXfHTINVCuQMMyZr/Wr+UVtgqNz9jJLG2OLPt9LH41aI2Qi7PNfyY3aJu6wX6hOK8KSsMK+3eMczzaqTA48wffRhL6ME6cHHuYDrUKCsIAU6GAYGlap3BqqorMFzjOJvw5FxqRPFpLr4NwjLFA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bPpVZmG3; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bPpVZmG3" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2163affd184so125915ad.1 for ; Fri, 10 Jan 2025 08:42:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736527321; x=1737132121; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=dV58z0nJ44j5t2aJuwKc3i2eVlBRn5ILcjtzVtoWX7w=; b=bPpVZmG3VPKU1kKjT9AqN8RIaGavL433eCsZAFhjsN0y2npdgUXlIvk15N6yWwLGWr lt6MUztTdKpnQqwiJ/zmiq/v6zfV7Qp6ptEUaMKGkuPa/FHeKNvjFFtxrX9HW/qLNCdy gx072l59MWHFlIt6Xz0d9aJZCRt1A4aQgYS2xKKOCOT3rzS71JTjVFLerLpOxUH/hfWX 6XYfm3ni4VSf3l4W9aE1Svxs162yRlfPaIk3pE1mZRSwx8RdIbccF7HSXmqPb+apUSy8 2ZRM3UUIKddOHgzMipycobBSjDDfb0dUidbTVE7y6CvWSWkEqyKwhz/SHMP6Hkvg0cvC skdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736527321; x=1737132121; h=in-reply-to:content-transfer-encoding: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=dV58z0nJ44j5t2aJuwKc3i2eVlBRn5ILcjtzVtoWX7w=; b=Qj767xBiFZBLBp6/Qvhm2jQa8dcn3RWEqfg8dfZnmsNX6c//iI0n2AhljqV28Zfbyp amTbGg/Ulay0mhW/hsci89Y7Z/Z9P3+mcKiWTZE9lhE8y2OAxodqPvSwNyKH6GjULSln YnIO+pBbJvXneeplxmxkr+UAOkOhbOK7fk6BKDV9kP/f99eBkl4Ez70XZgVTZSkhyXUx DdD/I9XllEahbY97ziOOqxlS5kQDIJDn9Ei3YxXGBPKlCYFjHfhaQPilupZ4jU3XLyut eaAK2q03kyBrnKuQfyexKkcoB4elVU8Q/tYUCsIB5BShQ6PXIMIpzpbeJG+mBs35+qQX B6BA== X-Forwarded-Encrypted: i=1; AJvYcCV8/MkRdVpxR2uAoN7QKGLFYEqSb4iMgDuL7/ZIk4zGDRtcJ8sicf1bBqDpJE3avAFlZUh2HYeshvhIDKQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3cdL974j2rn73fZ20wF+4wnEkMcrWvObxNdTkj2BFM9shSzdu 70BIo0COq9DLQ1vvX2Q3nnPcsXubBX7FydMnvnsZ80jkueZPNc+8o5hj1xGb7a5bcP3UbVGzhYZ g1Ayi X-Gm-Gg: ASbGnctCwSJWWCOxTue8pE2ddo2ol8cAeRZ9QDF5PN9SS6qRlE7DX3b8o1k/mvGmKj5 6YB9RvxzD6QlO4mNQU07VikPd6UGyhyPaMakAAf0xpm47wj5zkhi0dSJvuL2Y/fAtMnm7PV9hs5 bpv3Vy0QB4unRM2KO3PgvVTxeCTZPN5CzyraMWX8/HWoO6RQrLumU4yh1KROGfB8UdZXtFoeFiQ O7rh9jHHuAXSFN8vJX8uM5ug20f8Mhu4WVUmUscpGSj3nFL/VWiM89xzQ== X-Google-Smtp-Source: AGHT+IFXrt64XWN5+xxbt3NGJ7TQWkuqYQKPyGO8+oeAQoVify+8kHR+ehnu9S0Eu95eQXGzwLq4qA== X-Received: by 2002:a17:902:7088:b0:212:26e:1b46 with SMTP id d9443c01a7336-21aa33b7344mr2173005ad.23.1736527321425; Fri, 10 Jan 2025 08:42:01 -0800 (PST) Received: from google.com ([2620:15c:2d:3:99d3:ef93:6e2e:8b59]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f219a94sm15767945ad.129.2025.01.10.08.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 08:42:01 -0800 (PST) Date: Fri, 10 Jan 2025 08:41:56 -0800 From: Isaac Manjarres To: Alice Ryhl Cc: lorenzo.stoakes@oracle.com, Andrew Morton , kaleshsingh@google.com, jstultz@google.com, surenb@google.com, kernel-team@android.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] mm/memfd: Refactor and cleanup the logic in memfd_create() Message-ID: References: <20250109185908.1006310-1-isaacmanjarres@google.com> <20250109185908.1006310-2-isaacmanjarres@google.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Jan 10, 2025 at 10:12:13AM +0100, Alice Ryhl wrote: > On Thu, Jan 9, 2025 at 7:59 PM Isaac J. Manjarres > wrote: > > > > memfd_create() is a pretty busy function that could be easier to read > > if some of the logic was split out into helper functions. > > > > Therefore, split the flags sanitization, name allocation, and file > > structure allocation into their own helper functions. > > > > No functional change. > > > > Signed-off-by: Isaac J. Manjarres > > This looks reasonable to me. One nit below, but: > > Reviewed-by: Alice Ryhl > > > fd_install(fd, file); > > + /* name is not needed beyond this point. */ > > kfree(name); > > return fd; > > This comment seems superfluous at this point, since kfree(name) is the > last statement of the function. > > Alice Thanks! I'll go ahead and remove that and send out a new version. --Isaac