From patchwork Tue May 26 11:38:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stanislav Kholmanskikh X-Patchwork-Id: 1297924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=gp32S79W; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WX6y2JtKz9sRY for ; Tue, 26 May 2020 21:39:21 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 90B763C327B for ; Tue, 26 May 2020 13:39:11 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id A99043C326F for ; Tue, 26 May 2020 13:39:09 +0200 (CEST) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id C9D2C1000CA0 for ; Tue, 26 May 2020 13:39:08 +0200 (CEST) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04QBW7d7027863 for ; Tue, 26 May 2020 11:39:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=k6HduwDZtbewd/2ZeT7kCKB51C9oBizPkiubmgHX1Aw=; b=gp32S79WAKs601qUaVJPONOS3Gy8Ivu2h792/KqHCL8lIuUR6daptw0bedLagaDPcemR gkNwuZscv+lD+NgieKnzuYT9DNZ7b3J/KZKXxr6fUo089egKWVYxAjN7B+85aDCxfZUc CS8/KRKUAb6SjeDVID8mKknIneD3vi59Rna6xMkdaJkeMyMM/SRV7UUbwwJslvXAYUvK MtKYXpxOS7VpqnvvvfG1VBz3ON9npH/RbFWhADc0OvRiDVWtht6DPtgzQ+aQ8NeuaACL 5q7AQhgrNdKTe+dooSDseAuXsOCkXbg2MSxcuy6duznpGiKdv9yS61TtX1HoBs//4/MI fw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 318xe1970t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 26 May 2020 11:39:03 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04QBXXW9196352 for ; Tue, 26 May 2020 11:39:02 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 317dks9euy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 26 May 2020 11:39:02 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 04QBd0aR023088 for ; Tue, 26 May 2020 11:39:02 GMT Received: from fujitsu.nl.oracle.com (/10.175.5.154) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 May 2020 04:38:59 -0700 From: Stanislav Kholmanskikh To: ltp@lists.linux.it Date: Tue, 26 May 2020 14:38:47 +0300 Message-Id: <20200526113847.6837-1-stanislav.kholmanskikh@oracle.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9632 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 bulkscore=0 spamscore=0 suspectscore=1 mlxscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005260087 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9632 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 cotscore=-2147483648 mlxscore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1011 impostorscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005260087 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH] acct02: fix the ac_version check on big endian platforms X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" If we are on a big endian platform where char is signed, the following compilation error is emitted: acct02.c: In function ‘verify_acct’: acct02.c:38:37: warning: comparison is always true due to limited range of data type [-Wtype-limits] #define ACCT_MEMBER_V3(x) (((struct acct_v3 *)acc)->x) ^ acct02.c:144:6: note: in expansion of macro ‘ACCT_MEMBER_V3’ if (ACCT_MEMBER_V3(ac_version) != (3 | ACCT_BYTEORDER)) { and the test case fails, because it cannot 'decrypt' the ac_version from the file: acct02.c:238: INFO: Verifying using 'struct acct_v3' acct02.c:191: INFO: == entry 1 == acct02.c:146: INFO: ac_version != 3 (-125) One way to address that is to explicitly cast the expression we compare to (which is int) to the type of ac_version (which is char). Signed-off-by: Stanislav Kholmanskikh Acked-by: Jan Stancek --- testcases/kernel/syscalls/acct/acct02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c index d6b16b8..8ee1bfc 100644 --- a/testcases/kernel/syscalls/acct/acct02.c +++ b/testcases/kernel/syscalls/acct/acct02.c @@ -141,7 +141,7 @@ static int verify_acct(void *acc, int elap_time) ret = 1; } - if (ACCT_MEMBER_V3(ac_version) != (3 | ACCT_BYTEORDER)) { + if (ACCT_MEMBER_V3(ac_version) != (char)(3 | ACCT_BYTEORDER)) { tst_res(TINFO, "ac_version != 3 (%d)", ACCT_MEMBER_V3(ac_version)); ret = 1;