From patchwork Sat Jul 30 00:37:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9253015 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 CBBA36075F for ; Sat, 30 Jul 2016 00:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B96BD283A6 for ; Sat, 30 Jul 2016 00:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA77D28444; Sat, 30 Jul 2016 00:38:07 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 4E220283A6 for ; Sat, 30 Jul 2016 00:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbcG3AiG (ORCPT ); Fri, 29 Jul 2016 20:38:06 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36447 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbcG3AiD (ORCPT ); Fri, 29 Jul 2016 20:38:03 -0400 Received: by mail-pf0-f195.google.com with SMTP id y134so6204543pfg.3 for ; Fri, 29 Jul 2016 17:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y+86sqqQgAJcy0qwez4hgTr4NemBmOPu8BhZP0hyFqo=; b=qNW1Qn29zPCcTYBJ+w30JrnxIERd77QtMtgHlbJpOoa4SM1zIx1JaCdqmsLszPxG1R cxVCxlTpdr4oYuXW2nEVlT3OTZSO1N0wDdkCmBR8jWHtRXqGoIGQF00fo9SjuuibTGbK UZKVwJVKxLqR61bG6oREjQWGKoCRC2CIQn7Z0n22fOk5IQ2awySJfJ+91UK6IYudx19z Vd3vwd1OHgzmeG+XG2onlYm/PgP1g98m5MdN+EcpMo9E4+7ctYP0Jyl0RSCkQIPNmYt6 uUR2fLYmXirfvQgWfzcAldqn6dgLkN3Ee0YfKkdlwflcjTtK9BehphIZ6H5F39xba6tc PNHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y+86sqqQgAJcy0qwez4hgTr4NemBmOPu8BhZP0hyFqo=; b=gJ/syOYBwJZSIku17Ha37e7YHVF46l7inJGbatXXsqiuJpXaPY6LUe/qamIGi+j9bq iMl/uyTdQE6fXrMv5k7XCXOSX7vM7QN0uRVChis6jl971F1jP0Sij96oSQEzgRhn7xDi Zb6PYPd4oNE8cf7aY9uaCKdSpu2Rmn7vkDXkDRpmZZeuy1WSos4VSVBbldVVr4yx3G4U Dvqd9mvLE7zTfvsgEYJAZxgwuPvOklmSTswA7mcjEyBs2v5WsVJD4g07uZ0R27Jyzujb L4Q9GNHIGJTMJ501qrYevyMzI1fKgcF7ipThnGA/wK4iPfKwZOxuwMwhkeo+AfzVHYRX rIsw== X-Gm-Message-State: AEkooutU4kPXskGVUfOEECZtc+FbRJMg53YRHa0NCVB6CxULwlpr282IAcGA4/sMtSgZgQ== X-Received: by 10.98.87.90 with SMTP id l87mr73516174pfb.133.1469839082141; Fri, 29 Jul 2016 17:38:02 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id xv9sm27592261pab.36.2016.07.29.17.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 17:38:01 -0700 (PDT) From: Wei Yongjun To: Ilya Dryomov , "Yan, Zheng" , Sage Weil Cc: Wei Yongjun , ceph-devel@vger.kernel.org Subject: [PATCH -next] libceph: fix return value check in alloc_msg_with_page_vector() Date: Sat, 30 Jul 2016 00:37:57 +0000 Message-Id: <1469839077-3607-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the function ceph_alloc_page_vector() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 1907920324f1 ('libceph: support for sending notifies') Signed-off-by: Wei Yongjun --- net/ceph/osd_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index b5ec096..a97e7b5 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -4220,7 +4220,7 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr) pages = ceph_alloc_page_vector(calc_pages_for(0, data_len), GFP_NOIO); - if (!pages) { + if (IS_ERR(pages)) { ceph_msg_put(m); return NULL; }