From nobody Mon Sep 28 04:56:13 2026 Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com [111.22.67.135]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71B80372075 for ; Wed, 26 Aug 2026 09:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.22.67.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787735883; cv=none; b=Yz53fgTJt4XEChqa+SYQE5mjbL1Bf7QKXu5oOwlySUrktRlI8tMlvtdGhBn4Av51PKmiv6/Nht7RnndNE54zB4wyDESXIl11sRcfbjowTAQa2SQstUJhLx1hpL8M35Xu1a3x3Z1h1XVBNIvqxpuY92sLqJIw4HbiqMIEJQBINYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787735883; c=relaxed/simple; bh=36Pq9DUGkliBV+JHvGc+QRaQZIu92HhtN+Q5kSQf5fI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rI0i6SkIBgKPkXflr5LJ50jP8PcfWV8OfR06/VV4Q6pD2P9Z7R7tV6IFIDVh8W3tVlQ2v+2Mse64h6oTQ8GRHB0T9rA7ilDsucwwZaRNC3rLGEbiswZRSVy/VIAY88Hfyeb4qaI9RXZkYT6b8XxrXzYGLgWyj9ePqGJ3Idg8pD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.b=bfcu/+Wq; arc=none smtp.client-ip=111.22.67.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.b="bfcu/+Wq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=bfcu/+WqNmNRjbbukKTqfwAnv0ndNiX2k81kVZo8e5QxZjm3NBHhY0Je02rz/ylSUHqPgeYY4saqL v19fcnJVi+UI2keRBhFV977ngd80zbjYBjCIqPdAGpXKYNcfDGZEJABvpwLidUMpVgb5pNhCuZBBxT OjTMCRJiD9Kh3PzE= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app07-12007 (RichMail) with SMTP id 2ee76a8eae8a8af-69d50; Wed, 26 Aug 2026 17:14:50 +0800 (CST) X-RM-TRANSID: 2ee76a8eae8a8af-69d50 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from Z04181454368174 (unknown[36.137.216.22]) by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee96a8eae8691f-fa2ff; Wed, 26 Aug 2026 17:14:49 +0800 (CST) X-RM-TRANSID: 2ee96a8eae8691f-fa2ff From: zhangjiao2 To: gregkh@linuxfoundation.org Cc: kstewart@linuxfoundation.org, pombredanne@nexb.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, trivial@kernel.org, zhang jiao Subject: [PATCH] samples: timers: hpet_example: Fix fcntl() error check Date: Wed, 26 Aug 2026 17:14:42 +0800 Message-ID: <20260826091443.3168-1-zhangjiao2@cmss.chinamobile.com> X-Mailer: git-send-email 2.50.1.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: zhang jiao fcntl() returns -1 on error, but hpet_fasync() compared the return value against 1, so fcntl failures were never detected. Use "< 0" instead. Signed-off-by: zhang jiao --- samples/timers/hpet_example.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/timers/hpet_example.c b/samples/timers/hpet_example.c index f1cb622f6ec0..0be3f2418af6 100644 --- a/samples/timers/hpet_example.c +++ b/samples/timers/hpet_example.c @@ -247,10 +247,10 @@ hpet_fasync(int argc, const char **argv) return; } =20 - - if ((fcntl(fd, F_SETOWN, getpid()) =3D=3D 1) || - ((value =3D fcntl(fd, F_GETFL)) =3D=3D 1) || - (fcntl(fd, F_SETFL, value | O_ASYNC) =3D=3D 1)) { + value =3D fcntl(fd, F_GETFL); + if ((fcntl(fd, F_SETOWN, getpid()) < 0) || + (value < 0) || + (fcntl(fd, F_SETFL, value | O_ASYNC) < 0)) { fprintf(stderr, "hpet_fasync: fcntl failed\n"); goto out; } --=20 2.33.0