Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp774413iog; Wed, 15 Jun 2022 12:02:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1urohdLU1ub/e5LS4BY6J8gvtlcgMGikJT3+8p/qWE1/rkEWnj1ZF/08Tu3aLiVoyJ2nO9T X-Received: by 2002:a05:6a00:179b:b0:51b:f51f:992e with SMTP id s27-20020a056a00179b00b0051bf51f992emr916510pfg.60.1655319729228; Wed, 15 Jun 2022 12:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655319729; cv=none; d=google.com; s=arc-20160816; b=piRfOYInHpuxX5tr2sK6gfpiNco90AAehHimoPFOjxIQkaG16tfxaq6KvjqAmY4C3x JTeDOdae86os8AOTGpQDJT0qg1rPjHa55eiqjXrZ3tHt9SDUd2n3pmEO69qLON2ZsyzJ Z2czNpeFYfTMaFhiZJ+4dpKldz1H+4lQd2jlrNMyIx3cfDEhUxtVf8sX7LkZ3Y6pRbef 2cfexsQy4o5uGSv981tAGP+NUW0E92lp2aUHZNIUJymI61blpqw+wB12q+mUBPnal1L6 zfT45FwtMEv8yIBm1AuRwB2G3msGIOSJdpWIbY7Z1ZN/A/CbZRQZ1U/COefzoP68jpGB PMeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=36exi3O6agXxwcU//5GjvMbnAwmTe6euOEt77DFCUdA=; b=cXBC9NsAVZrtDjYrupijXBCpWZujiHmd4WyAVYmSGmSphP13d8wFbpvdoTze5rycJW iGdYARedSy27BAvivvmUJATrsZdHNndt3SzwpFClAwyo4IdJx2wvkpyCyvhZV1waNOSn XxR2elqigQABdyZB+17wqHnqwyHS6hiL1+VB58xl+rYwvk3NGdxeTayKLIvUG9kR+L/0 7exKG9SiP7sb7T9AsoMv/HcoISaqGfMNHnj7istb98///EEJ2qWi34LJ7n97Tr2erEJx Z3FYdkiwtqL/RsXQmGPSSqmojiB3Jn1BC3HM/U82h69aZ7VCFlvfZIS0ytQ+lvxlZYSg OI1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a634613000000b003fd260239b6si19652166pga.584.2022.06.15.12.01.55; Wed, 15 Jun 2022 12:02:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355703AbiFORyX (ORCPT + 99 others); Wed, 15 Jun 2022 13:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235028AbiFORyV (ORCPT ); Wed, 15 Jun 2022 13:54:21 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6634E26117; Wed, 15 Jun 2022 10:54:20 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTPS id 33E96520291; Wed, 15 Jun 2022 19:54:18 +0200 (CEST) Received: from lxhi-065 (10.72.94.5) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 15 Jun 2022 19:54:17 +0200 Date: Wed, 15 Jun 2022 19:54:12 +0200 From: Eugeniu Rosca To: Roberto Sassu , Mimi Zohar CC: , , , , , , , , , , , , , , , , , Dirk Behme , Eugeniu Rosca , Eugeniu Rosca Subject: Re: [PATCH v4 1/3] initramfs: add file metadata Message-ID: <20220615175412.GA7029@lxhi-065> References: <20190523121803.21638-1-roberto.sassu@huawei.com> <20190523121803.21638-2-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190523121803.21638-2-roberto.sassu@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.94.5] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Roberto, Hello Mimi, On Thu, May 23, 2019 at 02:18:01PM +0200, Roberto Sassu wrote: > From: Mimi Zohar > > This patch adds metadata to a file from a supplied buffer. The buffer might > contains multiple metadata records. The format of each record is: > > > > For now, only the TYPE_XATTR metadata type is supported. The specific > format of this metadata type is: > > \0 > > [kamensky: fixed restoring of xattrs for symbolic links by using > sys_lsetxattr() instead of sys_setxattr()] > > [sassu: removed state management, kept only do_setxattrs(), added support > for generic file metadata, replaced sys_lsetxattr() with > vfs_setxattr(), added check for entry_size, added check for > hdr->c_size, replaced strlen() with strnlen(); moved do_setxattrs() > before do_name()] > > Signed-off-by: Mimi Zohar > Signed-off-by: Victor Kamensky > Signed-off-by: Taras Kondratiuk > Signed-off-by: Roberto Sassu > --- > include/linux/initramfs.h | 21 ++++++++++ > init/initramfs.c | 88 ++++++++++++++++++++++++++++++++++++++- > 2 files changed, 107 insertions(+), 2 deletions(-) > create mode 100644 include/linux/initramfs.h [..] > +static int __init do_setxattrs(char *pathname, char *buf, size_t size) > +{ > + struct path path; > + char *xattr_name, *xattr_value; > + size_t xattr_name_size, xattr_value_size; > + int ret; > + > + xattr_name = buf; > + xattr_name_size = strnlen(xattr_name, size); > + if (xattr_name_size == size) { > + error("malformed xattrs"); > + return -EINVAL; > + } > + [..] > + > + switch (hdr->c_type) { > + case TYPE_XATTR: > + do_setxattrs(pathname, buf + sizeof(*hdr), > + entry_size - sizeof(*hdr)); Is it on purpose not to check the return value of do_setxattrs? I think I would have more comfort and piece of mind if I knew the return value is properly checked and acted upon. Otherwise, why returning an int from within do_setxattrs() at all? BR, Eugeniu