From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 987BDC28EBD for ; Sun, 9 Jun 2019 17:01:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5ED6B206C3 for ; Sun, 9 Jun 2019 17:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099715; bh=UT5ptIzvBWmArzRHvLDDWZswCaWyxEW9/R4B4KcsSDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oCyys6Z3LqXEbhumGWFlxK3itwkiLRavD0tvdEVqv0VyFq8t9s+gXLKInnEnHjOPK nR+EIQFQoHY7cuNhR7n4STd00t75GJ6uSqFCMAtdO3JwE+T/NjZOEBqqc+7md8ANDz cJi37jBaV4mPG3tFQ0YGskXw9Cdt0wiHsXqGzWKk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732800AbfFIRBy (ORCPT ); Sun, 9 Jun 2019 13:01:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:39454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388131AbfFIRBx (ORCPT ); Sun, 9 Jun 2019 13:01:53 -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 1E0CD208C0; Sun, 9 Jun 2019 17:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099712; bh=UT5ptIzvBWmArzRHvLDDWZswCaWyxEW9/R4B4KcsSDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fcwdO+4ohZGs154fSE2S+pSbIC8I2mVM/FXh+Q84/yhTA4uBBKsqB9PtcD/WfOzdi /DBMe2wI3hkhq8i9Y/Fs+6SzTk1YpvJTfw+V+tC07Ip2CBH21GIK3U584QVq+A1/KT KoJqFyPWA5p/PwdDcKXOmDb98lH1uCQPwzq/9KWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bo YU , Michael Ellerman , Sasha Levin Subject: [PATCH 4.4 096/241] powerpc/boot: Fix missing check of lseek() return value Date: Sun, 9 Jun 2019 18:40:38 +0200 Message-Id: <20190609164150.565716531@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164147.729157653@linuxfoundation.org> References: <20190609164147.729157653@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 [ Upstream commit 5d085ec04a000fefb5182d3b03ee46ca96d8389b ] This is detected by Coverity scan: CID: 1440481 Signed-off-by: Bo YU Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/boot/addnote.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c index 9d9f6f334d3cc..3da3e2b1b51bc 100644 --- a/arch/powerpc/boot/addnote.c +++ b/arch/powerpc/boot/addnote.c @@ -223,7 +223,11 @@ main(int ac, char **av) PUT_16(E_PHNUM, np + 2); /* write back */ - lseek(fd, (long) 0, SEEK_SET); + i = lseek(fd, (long) 0, SEEK_SET); + if (i < 0) { + perror("lseek"); + exit(1); + } i = write(fd, buf, n); if (i < 0) { perror("write"); -- 2.20.1