From patchwork Mon Apr 8 17:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10889917 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 0D9921390 for ; Mon, 8 Apr 2019 17:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E117E28793 for ; Mon, 8 Apr 2019 17:13:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5689287AE; Mon, 8 Apr 2019 17:13:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 5C2C728763 for ; Mon, 8 Apr 2019 17:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727367AbfDHRNr (ORCPT ); Mon, 8 Apr 2019 13:13:47 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40610 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728905AbfDHRNr (ORCPT ); Mon, 8 Apr 2019 13:13:47 -0400 Received: by mail-pg1-f195.google.com with SMTP id d31so3150852pgl.7 for ; Mon, 08 Apr 2019 10:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=zFQBbigOTEog9L119nzi8yUiDvvH6RzigfyLgG6e7ew=; b=A+grWCdx8z6DrlFCINwSLbdf9vaJ7EjSoWTqNtWAYNMIyN+2qOt3uI4yxc/tXEXyg6 dQwK6bkrKK1/uoT39PDU+fb7IQYs+t4wnjMD/xTfE5X7xmalBdq0nDqcZfuUb54j9FsH J/jFy9SleTnf3cpSJiLA7pg20hVWQx5J9sI3M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=zFQBbigOTEog9L119nzi8yUiDvvH6RzigfyLgG6e7ew=; b=UC0jeo3Q/ppdj1XIPehCIKIaksnQFmWP3sW1mL4eXI/lylXJjr86Pz3NG4MDbig+rE jmbbo+wv960SlP2pCXzw94giTBBHmP14dqXmp9UaWjLAxOm8h3bVLICZfMqm0GoUQGPD R3VwfUDwjVkA/2/NpvBhh9+cLXYT+oecGsCCTcjP95eHl0gvsnyVLJggLgAgnZS+47Ql G0C2TSFQDwPrW0ISQqzDjyXVWTJVX0+28+gs/zzqQ7gmCAVQtRV00o5r8myDdSjtqx2k tPMvSC02BPm6h+5iR97nv/UTKmN8XXefPEaMUhcb9M9TkQHwUG9d87L5vv7GhzKj8n2E 8djA== X-Gm-Message-State: APjAAAV4/LHILhSlekG8d0mApXOZI+AB4MTYGQYuOK2e9ocnvaSuP/yB SsJTQcA+NYRqgbmvxYnbBTvG3Q== X-Google-Smtp-Source: APXvYqys6hvSOZ9splDIvNZr1em+rB79WhDX7d53/z4j33eJRfaI58bJnejLgDCzio9DPkERc3gyhQ== X-Received: by 2002:a62:1795:: with SMTP id 143mr31584409pfx.104.1554743626910; Mon, 08 Apr 2019 10:13:46 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id v43sm17080239pgn.57.2019.04.08.10.13.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2019 10:13:46 -0700 (PDT) Date: Mon, 8 Apr 2019 10:13:44 -0700 From: Kees Cook To: Shuah Khan Cc: Stanislav Kinsbursky , Manfred Spraul , Davidlohr Bueso , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests/ipc: Fix msgque compiler warnings Message-ID: <20190408171344.GA22803@beast> MIME-Version: 1.0 Content-Disposition: inline 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 This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations. Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Kees Cook --- tools/testing/selftests/ipc/msgque.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index dac927e82336..4c156aeab6b8 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c @@ -1,9 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 +#define _GNU_SOURCE #include #include #include #include -#include +#include #include #include "../kselftest.h" @@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque) return 0; destroy: - if (msgctl(id, IPC_RMID, 0)) + if (msgctl(id, IPC_RMID, NULL)) printf("Failed to destroy queue: %d\n", -errno); return ret; } @@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) ret = 0; err: - if (msgctl(msgque->msq_id, IPC_RMID, 0)) { + if (msgctl(msgque->msq_id, IPC_RMID, NULL)) { printf("Failed to destroy queue: %d\n", -errno); return -errno; } @@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque) int dump_queue(struct msgque_data *msgque) { - struct msqid64_ds ds; + struct msqid_ds ds; int kern_id; int i, ret; @@ -245,7 +246,7 @@ int main(int argc, char **argv) return ksft_exit_pass(); err_destroy: - if (msgctl(msgque.msq_id, IPC_RMID, 0)) { + if (msgctl(msgque.msq_id, IPC_RMID, NULL)) { printf("Failed to destroy queue: %d\n", -errno); return ksft_exit_fail(); }