Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp734691ybn; Wed, 2 Oct 2019 05:28:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5s7FHkpMXHvPHBeEEmlTznT2MGuMPN2j85S+zMwfocomiQe/7r0e4cCvPNioKSYdqWS27 X-Received: by 2002:a50:9e0a:: with SMTP id z10mr3499738ede.202.1570019281397; Wed, 02 Oct 2019 05:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570019281; cv=none; d=google.com; s=arc-20160816; b=P09GH+5clo2NYnaalipUoMZRE2rbKb9Pc1TudlfSCivtKnpRSdzIZMrrEeBAH+EL/i FnidXOIzOpi57yeoslgJUhpqRBt75zvQfxlAsIMCh7yS9ITbcBJsWTJNRE16szr8cLXy Va2pEutg1OKu+s3Zcx1XD/FGNDLMufl0SZ4OrN0bNQyeN53STiIr4UTetXdHkjd3ms5R 2bThqQ7Vk0c/N09m+41Op+0n9xeZsqtAF/Uv4Pn401Kf6RpWs45J9g6/CENGaN3FTJLp eEIrKL1LR9X4XTa90HoQjQvTbYAteHS5uqz4ni/krIP7j+mbKMHeDwL7pYtBTT6/NMlf 920Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TMB6TblY53+4VyVSJtgn0L5ohD/FsUtecY9KXTnnDX4=; b=kpOARo89bp8HDaOWS6sZEhrOa8K0EQGcq5TyNphs2JhaL9zyz/MKXSEWZRYHhcOm/F ej42xzfj+jYKwJRFBOAeMllIuHaZbkU8x+7yJTUxQU5j/tCU3rKn+xLxVwLqYCNUM8PM veDeipJ1dSUhvrLDGF0lI3Z4bkaGd+t8YQn389e2gIOh58uT+eMTFpuhh0+EXB1ZAJmQ 4SM0iHd+eSkYcr7FJ1oRWAETspE/SsTxJip0r0dFoahV6mzpVoLH9fMZ8FdemCVI1cCj fIvCKuZdA4/DroDsS02tLexOX2m7pAqX+L/iQgpb4vMOtg8u89t6hLjaCJxTUJifuS3Y 3E0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DqsD2s9P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si10159807ejr.125.2019.10.02.05.27.36; Wed, 02 Oct 2019 05:28:01 -0700 (PDT) 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=@linaro.org header.s=google header.b=DqsD2s9P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728424AbfJBME1 (ORCPT + 99 others); Wed, 2 Oct 2019 08:04:27 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:43487 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728350AbfJBMER (ORCPT ); Wed, 2 Oct 2019 08:04:17 -0400 Received: by mail-lf1-f67.google.com with SMTP id u3so12521465lfl.10 for ; Wed, 02 Oct 2019 05:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TMB6TblY53+4VyVSJtgn0L5ohD/FsUtecY9KXTnnDX4=; b=DqsD2s9P1SD/PtORTHEVfyScMUoIU61jGf1MvpZNqMizg2xPfFl/kReztOBlI4GO3e z1Go2J83GjLF8pQSMiXB4U4w1NUvICHnzC5UOXJa6j9dnv/CmSOdsXIclmhJu5ouVmiw cToPMiZ4rCxpRNxFnHuHNzLsiDwWc6LOOlN33hmZjj6W70SdmDvDd62PT+QmGNFua/B7 ooS7xH/oMHWaQ+xWj4FiiNRXj3PsjC+LqWib6sHftimrqCDAbyBFNlAuAVZcAXcj4Adn h8uW+B5LXmgVaa0IuMpmJC5qHZGVXmUXkW+tsLgrdOjtHofRERJ3R5BekTtFZDNYZVUk fx9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TMB6TblY53+4VyVSJtgn0L5ohD/FsUtecY9KXTnnDX4=; b=Fb4rEoxdP1S9B/tMBsc0yAQ3dIVgeF4VLTJtC1O1OrqsXbVelNfhbThf21gpMBf86B D91BVOaA4SmAflN3XOMZeIxz6xBYv5to2j5UVi//VPJNoTXnpM7EWQHT4ZVVpPPwNVu2 ICGFdhqGC9AYUiyXcTZYGVLKC6cOGj7RAaKGEx1DN/iDjtOIUzmFodVJC4LA8zM49gAX at3pjpLrJEyfHj1CkATc4nazfiJITL7LqypKazNIENbY+x3+PgKi8vdUPKiHUpCj9u6A SBqVQ8Hyt/dFZLGPTPOCsx7vaFvqu2SdI65SIt7bHETxH0XP6HILYTxxYVKoiptug6RT sWgA== X-Gm-Message-State: APjAAAWr1IV5wOrXxieaCfF/iiAdO38Pbt6NnYiknZZ3BYgx9aeR1jCH qatNTL8w9XLyUT6co2kTrNxCId+q0mA= X-Received: by 2002:ac2:4a69:: with SMTP id q9mr2037834lfp.86.1570017855074; Wed, 02 Oct 2019 05:04:15 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id x2sm4833827ljj.94.2019.10.02.05.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 05:04:14 -0700 (PDT) From: Ivan Khoronzhuk To: shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net Cc: kafai@fb.com, songliubraving@fb.com, yhs@fb.com, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH bpf-next 2/2] selftests/bpf: correct path to include msg + path Date: Wed, 2 Oct 2019 15:04:04 +0300 Message-Id: <20191002120404.26962-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002120404.26962-1-ivan.khoronzhuk@linaro.org> References: <20191002120404.26962-1-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "path" buf is supposed to contain path + printf msg up to 24 bytes. It will be cut anyway, but compiler generates truncation warns like: " samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c: In function ‘setup_cgroup_environment’: samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:34: warning: ‘/cgroup.controllers’ directive output may be truncated writing 19 bytes into a region of size between 1 and 4097 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~ samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:2: note: ‘snprintf’ output between 20 and 4116 bytes into a destination of size 4097 snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:34: warning: ‘/cgroup.subtree_control’ directive output may be truncated writing 23 bytes into a region of size between 1 and 4097 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/cgroup.subtree_control", ^~~~~~~~~~~~~~~~~~~~~~~ cgroup_path); samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:2: note: ‘snprintf’ output between 24 and 4120 bytes into a destination of size 4097 snprintf(path, sizeof(path), "%s/cgroup.subtree_control", cgroup_path); " In order to avoid warns, lets decrease buf size for cgroup workdir on 24 bytes with assumption to include also "/cgroup.subtree_control" to the address. The cut will never happen anyway. Signed-off-by: Ivan Khoronzhuk --- tools/testing/selftests/bpf/cgroup_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c index 4d74f3c4619b..0fb910df5387 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.c +++ b/tools/testing/selftests/bpf/cgroup_helpers.c @@ -98,7 +98,7 @@ static int enable_all_controllers(char *cgroup_path) */ int setup_cgroup_environment(void) { - char cgroup_workdir[PATH_MAX + 1]; + char cgroup_workdir[PATH_MAX - 24]; format_cgroup_path(cgroup_workdir, ""); -- 2.17.1