Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp29155ybj; Fri, 8 May 2020 05:53:41 -0700 (PDT) X-Google-Smtp-Source: APiQypKPgr0OyZ/Rps1UXPc+FUA0ze+WdtvLMyOJemVyQlXpE+L/GC0pXOsRqR/xFjRpb9cZmlRS X-Received: by 2002:a05:6402:602:: with SMTP id n2mr1955297edv.79.1588942421795; Fri, 08 May 2020 05:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588942421; cv=none; d=google.com; s=arc-20160816; b=fNftttZ92rWkQo84gGtuuYgnsx7krHespwogNKVFOLcXwIBDoDhzLO5IXoErf8Edse FZHstCez81VTosuq2NAIKW5l/URF1axlhOuRaVMsHZH5DsUY9mkuFTd73zVgFJU+1p4k qqQ6xhuZeRNDKiOURFnFqDtKZvWv2OkGXOdhwtjcxEF/OANnGghI62X262WTV5CENoEP bn7/YxZtiWThu4SUyBKBWbQytpYMi1RqGGw6vNpzEWLwB8sb0rXuslL92ivMAvqSUrJt id+5rNEAQHbwWHb3vbR9aUiFOhFJu61kpoyDdVxf6gJUWUHGn3cLG7BJtHmUHcm6tt4p rVlQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IJopSpulMulbRP0rFPa7HD7+P5M/kkJfHZAoHKMKz8Q=; b=havsNBRdq7HG8OQhP2JyBSxtX+34nYvi1qJkU8EHqWzM5lA+2iZYD4FxnmvFOmXgSm AQ6wXkllkzZbfCiJTxmVpOsttUdxDgusyjdK3i+esyvqCP8bDe2sPVfDIik23ngah57o 9HjdKzCzrgQAXHo9Btlkqh2WG5SXm0zN8R4hVRQh2+1p4j+Qv4smE6N8opgtXn343/dP 1s5ZCMXCNNN7vq0Zg15F6y7agDRkWdjpq59c9H9nv/8kuQAJ3lkxbMuFNT0t9Tw6az6o mjrGN52wktI19OeytNNpPynW5Ho48Hy2lcQceHVjy6wkyiS9G8IPVtQqSGi10t0iMiC9 daDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qct83M+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb6si939256ejb.255.2020.05.08.05.53.13; Fri, 08 May 2020 05:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qct83M+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729782AbgEHMtx (ORCPT + 99 others); Fri, 8 May 2020 08:49:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:56248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729770AbgEHMtv (ORCPT ); Fri, 8 May 2020 08:49:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4358A2495C; Fri, 8 May 2020 12:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942190; bh=iKLOjbISfSmx+ATUFlxMQc5jsMELnFldoSD6Jp2nEvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qct83M+Z8JcqQuGBg1hXskD7s6b6TihmnjPHPiJksQGT9cb83EVOb6NzfPZ9X3DzY /aTHmrzm7UtlWt/3KCgoSsX9pekO6wSfOEvLyNaG46qC+/0fnwlGrWrKqtOFR7uiSf m21TSi/S9dwV9qj8MC4P3Q4qoj2MKfQXAFshpOfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyler Hicks , Shuah Khan , Sasha Levin Subject: [PATCH 4.9 04/18] selftests/ipc: Fix test failure seen after initial test run Date: Fri, 8 May 2020 14:35:07 +0200 Message-Id: <20200508123032.136536893@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123030.497793118@linuxfoundation.org> References: <20200508123030.497793118@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Tyler Hicks [ Upstream commit b87080eab4c1377706c113fc9c0157f19ea8fed1 ] After successfully running the IPC msgque test once, subsequent runs result in a test failure: $ sudo ./run_kselftest.sh TAP version 13 1..1 # selftests: ipc: msgque # Failed to get stats for IPC queue with id 0 # Failed to dump queue: -22 # Bail out! # # Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0 not ok 1 selftests: ipc: msgque # exit=1 The dump_queue() function loops through the possible message queue index values using calls to msgctl(kern_id, MSG_STAT, ...) where kern_id represents the index value. The first time the test is ran, the initial index value of 0 is valid and the test is able to complete. The index value of 0 is not valid in subsequent test runs and the loop attempts to try index values of 1, 2, 3, and so on until a valid index value is found that corresponds to the message queue created earlier in the test. The msgctl() syscall returns -1 and sets errno to EINVAL when invalid index values are used. The test failure is caused by incorrectly comparing errno to -EINVAL when cycling through possible index values. Fix invalid test failures on subsequent runs of the msgque test by correctly comparing errno values to a non-negated EINVAL. Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Tyler Hicks Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/ipc/msgque.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index 1b2ce334bb3f0..47c074d73e610 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c @@ -135,7 +135,7 @@ int dump_queue(struct msgque_data *msgque) for (kern_id = 0; kern_id < 256; kern_id++) { ret = msgctl(kern_id, MSG_STAT, &ds); if (ret < 0) { - if (errno == -EINVAL) + if (errno == EINVAL) continue; printf("Failed to get stats for IPC queue with id %d\n", kern_id); -- 2.20.1