From patchwork Thu Jun 7 08:30:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10451445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D4FC76037F for ; Thu, 7 Jun 2018 08:30:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C58D529CBB for ; Thu, 7 Jun 2018 08:30:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C43AC29CE0; Thu, 7 Jun 2018 08:30:19 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 4E01129CD4 for ; Thu, 7 Jun 2018 08:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932661AbeFGIaT (ORCPT ); Thu, 7 Jun 2018 04:30:19 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43916 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932572AbeFGIaS (ORCPT ); Thu, 7 Jun 2018 04:30:18 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w578QNq0179975; Thu, 7 Jun 2018 08:30:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=+ydQ89D+z42bxiiz78Eao1v/kb9eg1Sl6b/qcnUH/Zs=; b=L4PoA7mleExxOVVxYehptdjYpUb0Be8CVJ9FJ/UXgaaGB7xKFwQ/RPVXDlccpQKL/gR5 3rLskxt93kYEvq0mR3iWh2363/gPYG42em4Rystqemqe+9BGnmRDq46/Illzl4npN+yT 5ytMgnAgPiJ5JnnJ3RvPJ7RrNYJjD3YqT8PW72KDVbV2iURWFvvneaP7H1ZFsS7iE++5 IadJP6f7aQvDlVfFqYJGROi4yjgerkYSjfiLLMAmx4Y4LfqFw/ONVcKVhGPvNEabKlsW tieJhxQ9ZZmQFZd51XuJkA7Z789OMEtC0dGniGRvzWDEgivstDReKGjPbIv8LpGI82y5 KA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2jbvyp7xc6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Jun 2018 08:30:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w578UB0h031343 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Jun 2018 08:30:11 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w578UAVE020884; Thu, 7 Jun 2018 08:30:10 GMT Received: from kili.mountain (/41.202.241.42) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Jun 2018 01:30:10 -0700 Date: Thu, 7 Jun 2018 11:30:02 +0300 From: Dan Carpenter To: Shuah Khan , Roman Gushchin Cc: Tejun Heo , Mike Rapoport , linux-kselftest@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] kselftest/cgroup: fix a signedness bug Message-ID: <20180607083001.m4z4wjev6j3sc423@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8916 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=861 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806070103 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "len" needs to be signed for the error handling to work. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c index b69bdeb4b9fe..1e9e3c470561 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.c +++ b/tools/testing/selftests/cgroup/cgroup_util.c @@ -35,7 +35,7 @@ static ssize_t read_text(const char *path, char *buf, size_t max_len) return len; } -static ssize_t write_text(const char *path, char *buf, size_t len) +static ssize_t write_text(const char *path, char *buf, ssize_t len) { int fd; @@ -140,7 +140,7 @@ long cg_read_key_long(const char *cgroup, const char *control, const char *key) int cg_write(const char *cgroup, const char *control, char *buf) { char path[PATH_MAX]; - size_t len = strlen(buf); + ssize_t len = strlen(buf); snprintf(path, sizeof(path), "%s/%s", cgroup, control);