From patchwork Wed Oct 2 12:04:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 11170945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A945F17EE for ; Wed, 2 Oct 2019 12:04:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8835321A4C for ; Wed, 2 Oct 2019 12:04:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OmP5kq+z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728352AbfJBMEQ (ORCPT ); Wed, 2 Oct 2019 08:04:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37291 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728339AbfJBMEP (ORCPT ); Wed, 2 Oct 2019 08:04:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id l21so16850106lje.4 for ; Wed, 02 Oct 2019 05:04:14 -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=Y95OajR8Z4EhoKVV/d/GtPK38UmcXtK59LFx+wA+Kn4=; b=OmP5kq+z+zbFpIxkBNzdy160yYdL/tMN7p+YDlhaPbcErQwKwPUXwv2VJg5sUXmyup ygBxLJXG5geeSgJTdIEycdXlvcJ4VTiDNeCAcPjC9oX6zR5voiv5Ww3rBRcWuZD7otui XmJuS4uPT/e5ZSoyF4+mdfA9VFyOem72gpoqPJVVo9aWJuI2LHax7Cs3gE8ErSWQazFK JaESnbyXsinx1R/cgxTvkqrAHVdAH6gFw5ZUBlVLwH3Uwfnogt6FlnURjAsPrds0wVmq reyXAR9+mGKS3WAcXU8dMUB8XLZ00ncKR8c6OPrSVvIyojBl/q0L730b+Ns7dEOXDGfS 0eeg== 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=Y95OajR8Z4EhoKVV/d/GtPK38UmcXtK59LFx+wA+Kn4=; b=KUhp8CE2pIGeGcJQpLpNT+QTHiqBQ/KuKAacM7xP3IgxNOIkgiHFJqvifIj9oJRxoh kShBqdtZO3BHVciVY6TLusNgW5le8ckfcToEUrkIIXV+81dWylei4CvdRLRFFDF3uXoW BSh7kZSHzQLhpk1vNNdPhMNekbBLSFX5riiaWD2GJ6ERribxDB4ipL1JUe39I6BgWuoc 8KPRGH9QMSNHjaSlLdzHDlMU2qaNEDxN5FhqY9mH4QctfMasM69GX6jMWfLXwO0PQsPN P5wNnp8QAykDuv4lgFXCimyIGUm/sp8pCuSSFXZCejeBQlvmPLuZbVB1FAdPJ07oeoi5 WRGg== X-Gm-Message-State: APjAAAUWRp9E1qOeivAY2pXrI9/Ll8T/sT3f57oCZldp9Fi2uq8SOlif YDPNPIzHjedlcrJG+EzA/rIJgQ== X-Google-Smtp-Source: APXvYqwCgHv5cQQHT5flHSQGpsA/3qpFgY9BqKRSoHwTcS8bpTuL/U1VGR2qPBiljcvG8ANgpwX2YQ== X-Received: by 2002:a2e:5c09:: with SMTP id q9mr2285090ljb.4.1570017853751; Wed, 02 Oct 2019 05:04:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 05:04:13 -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 1/2] selftests/bpf: add static to enable_all_controllers() Date: Wed, 2 Oct 2019 15:04:03 +0300 Message-Id: <20191002120404.26962-2-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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add static to enable_all_controllers() to get rid from annoying warn: samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:44:5: warning: no previous prototype for ‘enable_all_controllers’ [-Wmissing-prototypes] int enable_all_controllers(char *cgroup_path) while samples/bpf build. Signed-off-by: Ivan Khoronzhuk Acked-by: Song Liu --- 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 e95c33e333a4..4d74f3c4619b 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.c +++ b/tools/testing/selftests/bpf/cgroup_helpers.c @@ -41,7 +41,7 @@ * * If successful, 0 is returned. */ -int enable_all_controllers(char *cgroup_path) +static int enable_all_controllers(char *cgroup_path) { char path[PATH_MAX + 1]; char buf[PATH_MAX]; From patchwork Wed Oct 2 12:04:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 11170947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FE4017EE for ; Wed, 2 Oct 2019 12:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 284C321929 for ; Wed, 2 Oct 2019 12:04:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DqsD2s9P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728375AbfJBMER (ORCPT ); Wed, 2 Oct 2019 08:04:17 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:36693 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfJBMER (ORCPT ); Wed, 2 Oct 2019 08:04:17 -0400 Received: by mail-lf1-f65.google.com with SMTP id x80so12553408lff.3 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=Npq7ayvfYuDRVPYMsv4mD3k1gze8SCIKemSE8nb9PXcT0YkOKVCQCDf7VOH3YKc2gj M+R4j1gCkVazunulMMlRjqsuB9YYQIHuWP9GmMzwwzl/l3ynUdziCaWAvPHBr1EPCBJp 4ZzhFoL7FpUAsE4JTyaDjN2pTf/3PWND1jYceeeiK/hrDDrx0DyJMuSFSxdluUBBFoYv z69DYpy1YXeRrv4YS8NrmBjj7blM/4mt0q3w6OpC72B0Mm3oQ4X1VHv3I+FVoLrbagLD aqa7C2obu2pmSYygIy72qbCW1V4NU5TY7i1LFURV0NS/j8Q9oyqZFEqL5cj2dsJjwEZJ hmjw== X-Gm-Message-State: APjAAAWTk51LSteAjvDpsewsa2XlJSQet1UHUs/Z9gcTtcqt0R1IzFHW FTj4PJAfP1j2ELGyJf2Uc6eLiQ== X-Google-Smtp-Source: APXvYqzf1bxl3vPpwa5mq2B5jjzpp5yAncmvsE9rUg1AJrtdAyaV4drWRLAx9gwUoPb8uqukbTOHWA== 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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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 Acked-by: Song Liu --- 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, "");