Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp915746ybl; Fri, 10 Jan 2020 08:51:40 -0800 (PST) X-Google-Smtp-Source: APXvYqy/JKHOvJ85+ZoAD5WY/OwW92qVgZH5p3xWQq5zcL7fafoUq6reP6zfvt2S/u9KWVgrrl8F X-Received: by 2002:a05:6830:138b:: with SMTP id d11mr3157516otq.38.1578675100106; Fri, 10 Jan 2020 08:51:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578675100; cv=none; d=google.com; s=arc-20160816; b=CRhDVmEOCzBf83zi6zZZtBn5Tg2k7R1rkPZkx6OLSk88L6uyxH9Z1jwewJyKdZwDeV xDdRcBP6k4sxZn7nSHRoHzz+a4oeiNv4rPp8uLNqHTW6kyoHSquoCWNgCrnF+mkdz4qs Z3NczzbEMgcOntrz8Gd3cLIslHhdJ/gBVwRfMMQ5xSoxGLcOW82bJX4EqswxLLtYt1eU r4rBZkUxuUDQxCtieyuyyaNDtCTAyPUv6swWFpxEcMqYUc3jTrqiw49n7IAW4wKYr0wl j28L9HrElJHwfZBOH6blSg8Y/ooEb2/CsK4xfq+yXzUw3H5MaFMRZka+y1cI8EyCksK+ fBSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3vSiXmE4hm+vY407xZeDV00oZSz7P7Tb6Wxmt50cGzo=; b=Rrer3uhjW+dGG2EovUiC6cT47xaHBySauYt5P4mOXbxjyNFJZWrF94JAiFfY4xpv41 dewEcq19QeIujoII6vnYzW8S8qGSykZZqXtTdkNdtGlKPORAJXsloXF7nUVeGh8UnUY7 kntRmYNRMEUiByYqMyeDKnLuq+QiPn+j648uEjlpUGT0rglNwCdfWdRRFnFWWMHHShzm wo8yzGn39Wbl4IcXK3EMakBUuMVE4NNMXkLGG3857O+PVrQwOuYPJjZkkfLW4Q2RP+DC v4akckyXGXWKhQZYsWGxb7/TnoVVfkDhEOMxHxPZOzGenXob62oIk4fUb0FmfGjR/WOT J6ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=qHL+7rDP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si1525095otq.203.2020.01.10.08.51.28; Fri, 10 Jan 2020 08:51:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=qHL+7rDP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728660AbgAJQue (ORCPT + 99 others); Fri, 10 Jan 2020 11:50:34 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39665 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728500AbgAJQue (ORCPT ); Fri, 10 Jan 2020 11:50:34 -0500 Received: by mail-lj1-f193.google.com with SMTP id l2so2808138lja.6 for ; Fri, 10 Jan 2020 08:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3vSiXmE4hm+vY407xZeDV00oZSz7P7Tb6Wxmt50cGzo=; b=qHL+7rDPAtspkZeTYhcfP5LoXq67SOKKWsQSUhE/9KZkhRscH/4+cy9tHxCw98hexJ KUDzz5DRsUDx6nHt72wgmEmyqxMhcBcJoQKzoV/LtB57t0eVZdBK8FxX7ZpGa+B95FAU IN3AiIFwMlm/s7QAh03vjgtcgPMb/tcOlA66kCH9ESNrqIhKPzyG6uUrPaaDOTVtkn5J YiLoKcBituDgLH7WqtJGBX5GhfjaYerfqaRX21UTu1bnJS83vLFVJcYqYZb28ZVdcp0d KH/d7sMxvnJzUbITb0kmRGHuj80q7Qm+8DF6zwo83ev2bICMJ9k8w3ko7UKQa3jjeEOV ssNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3vSiXmE4hm+vY407xZeDV00oZSz7P7Tb6Wxmt50cGzo=; b=knp0acccGvRCg1yAy9e89ROXECVwaiSWexyyxrGuhcvWSYnUSzAUXf408c/TJLs+pN Sony4C7DJyV1lxiOZEXI/RDusx/T6CInnFbelwhQDKCA70jEnRjVdlEgN3mBh/YCCqhZ 5N52pvuTjNWruTuMq8mDDp+jhb2vxyn2V0Wp+QOHtO3Jv50uxR3wtsCZEjTNgz9lpBec 4TkPugVuEsBH0g+HO9P2KwENuxz2Tp4ZEGWPgS0YUMOclLuYYViuxRyO8WD7yW1FGWET hspBf3nSCWJYCVCWMu42aPWxfWVHyXAkm69vcGImkKm/PusmjXRYhk3jGknWdNQI+oXa StCQ== X-Gm-Message-State: APjAAAUFlV2g3/X/ZLpKxEmEVMkdRJn1LSjhLrdV21U9TIH8Wf+tn6Hd AJ7CEZMc+P/hijnTunsy8GQe4Mjf6ejloM7MP7O+ X-Received: by 2002:a2e:3a12:: with SMTP id h18mr3321630lja.81.1578675032313; Fri, 10 Jan 2020 08:50:32 -0800 (PST) MIME-Version: 1.0 References: <20200110095856.76612-1-yehs2007@zoho.com> In-Reply-To: From: Paul Moore Date: Fri, 10 Jan 2020 11:50:20 -0500 Message-ID: Subject: Re: [PATCH] selinux: remove redundant msg_msg_alloc_security To: Stephen Smalley Cc: Huaisheng Ye , Eric Paris , James Morris , Serge Hallyn , tyu1@lenovo.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, Huaisheng Ye Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 10, 2020 at 10:13 AM Stephen Smalley wrote: > On 1/10/20 4:58 AM, Huaisheng Ye wrote: > > From: Huaisheng Ye > > > > selinux_msg_msg_alloc_security only calls msg_msg_alloc_security but > > do nothing else. And also msg_msg_alloc_security is just used by the > > former. > > > > Remove the redundant function to simplify the code. > > This seems to also be true of other _alloc_security functions, probably > due to historical reasons. Further, at least some of these functions no > longer perform any allocation; they are just initialization functions > now that allocation has been taken to the LSM framework, so possibly > could be renamed and made to return void at some point. I've noticed the same thing on a few occasions, I've just never bothered to put the fixes into a patch. We might as well do that now, at least for the redundant code bits; I'll leave the return code issue for another time as that would cross LSM boundaries and that really isn't appropriate in the -rc5 timeframe IMHO. I'll put something together once I finish up the patch/review backlog from the past few days. Looking quickly with a regex, it would appear that inode_alloc_security(), file_alloc_security(), and superblock_alloc_security() are all candidates. While not an allocator, we can probably get rid of inode_doinit() as well. -- paul moore www.paul-moore.com