From patchwork Sat May 20 09:49:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9738545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7755C600C8 for ; Sat, 20 May 2017 09:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 688D92854A for ; Sat, 20 May 2017 09:50:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B6FE285C1; Sat, 20 May 2017 09:50:22 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 EA7742854A for ; Sat, 20 May 2017 09:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751528AbdETJuR (ORCPT ); Sat, 20 May 2017 05:50:17 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:40057 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbdETJuQ (ORCPT ); Sat, 20 May 2017 05:50:16 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v4K9o9uZ024427 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 May 2017 09:50:11 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v4K9o94g018865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 May 2017 09:50:09 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v4K9o8oC008162; Sat, 20 May 2017 09:50:09 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 20 May 2017 02:50:08 -0700 Date: Sat, 20 May 2017 12:49:46 +0300 From: Dan Carpenter To: Fabian Frederick Cc: Al Viro , linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] fs/affs: fix an error code in affs_write_end_ofs() Message-ID: <20170520094946.o6l7rmizlvwq7mjg@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "prev_bh" is a valid pointer. "bh" is an error pointer. "written" is either an error pointer, or a the number of bytes we have written. If we haven't written any bytes then we want to return the error code stored in "bh". So we need to that before resetting "bh" to a valid pointer. This bug is older than git. Signed-off-by: Dan Carpenter Acked-by: Fabian Frederick diff --git a/fs/affs/file.c b/fs/affs/file.c index 196ee7f6fdc4..99610050199c 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -800,9 +800,9 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, return written; err_bh: - bh = prev_bh; if (!written) written = PTR_ERR(bh); + bh = prev_bh; goto done; }