From patchwork Fri May 17 12:06:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 10947867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EC161398 for ; Fri, 17 May 2019 12:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CC5E22B39 for ; Fri, 17 May 2019 12:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7ECD52793B; Fri, 17 May 2019 12:06:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D38822B39 for ; Fri, 17 May 2019 12:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728244AbfEQMG4 (ORCPT ); Fri, 17 May 2019 08:06:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:55778 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727221AbfEQMG4 (ORCPT ); Fri, 17 May 2019 08:06:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7C35AAF60; Fri, 17 May 2019 12:06:55 +0000 (UTC) From: Luis Henriques To: fstests@vger.kernel.org Cc: Luis Henriques , "Darrick J . Wong" Subject: [PATCH] src/attr_replace_test: limit size of extended attribute value Date: Fri, 17 May 2019 13:06:53 +0100 Message-Id: <20190517120653.22180-1-lhenriques@suse.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The maximum size for extended attribute values is 65536 (XATTR_SIZE_MAX). Since there are filesystems that can set blksize to really big values (CephFS for example has a default of 4M), it's easy to have this test failing with fsetxattr returning -E2BIG. Cc: Darrick J. Wong Signed-off-by: Luis Henriques Reviewed-by: Darrick J. Wong --- src/attr_replace_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/attr_replace_test.c b/src/attr_replace_test.c index 0720bfdc18ab..1ca9bf11ba58 100644 --- a/src/attr_replace_test.c +++ b/src/attr_replace_test.c @@ -9,6 +9,7 @@ #include #include #include +#include #define die() do { perror(""); \ fprintf(stderr, "error at line %d\n", __LINE__); \ @@ -44,6 +45,8 @@ int main(int argc, char *argv[]) size = sbuf.st_blksize * 3 / 4; if (!size) fail("Invalid st_blksize(%ld)\n", sbuf.st_blksize); + if (size > XATTR_SIZE_MAX) + size = XATTR_SIZE_MAX; value = malloc(size); if (!value) fail("Failed to allocate memory\n");