From patchwork Thu Aug 29 06:24:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Durgin X-Patchwork-Id: 2851151 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41997BF546 for ; Thu, 29 Aug 2013 06:36:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6571520260 for ; Thu, 29 Aug 2013 06:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C38A2023F for ; Thu, 29 Aug 2013 06:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755623Ab3H2Ggi (ORCPT ); Thu, 29 Aug 2013 02:36:38 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:35213 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755606Ab3H2Ggh (ORCPT ); Thu, 29 Aug 2013 02:36:37 -0400 Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id 685EF263E7; Wed, 28 Aug 2013 23:40:28 -0700 (PDT) Received: from vit.ops.newdream.net (unknown [38.122.20.226]) by mail.hq.newdream.net (Postfix) with ESMTPSA id 5F362263AB; Wed, 28 Aug 2013 23:40:28 -0700 (PDT) From: Josh Durgin To: ceph-devel@vger.kernel.org Cc: Josh Durgin Subject: [PATCH 1/3] rbd: fix null dereference in dout Date: Wed, 28 Aug 2013 23:24:05 -0700 Message-Id: <1377757447-23515-2-git-send-email-josh.durgin@inktank.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1377757447-23515-1-git-send-email-josh.durgin@inktank.com> References: <1377757447-23515-1-git-send-email-josh.durgin@inktank.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The order parameter is sometimes NULL in _rbd_dev_v2_snap_size(), but the dout() always derefences it. Move this to another dout() protected by a check that order is non-NULL. Signed-off-by: Josh Durgin Reviewed-by: Alex Elder Reviewed-by: Sage Weil --- drivers/block/rbd.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 80f787b..fef3687 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3702,12 +3702,14 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, if (ret < sizeof (size_buf)) return -ERANGE; - if (order) + if (order) { *order = size_buf.order; + dout(" order %u", (unsigned int)*order); + } *snap_size = le64_to_cpu(size_buf.size); - dout(" snap_id 0x%016llx order = %u, snap_size = %llu\n", - (unsigned long long)snap_id, (unsigned int)*order, + dout(" snap_id 0x%016llx snap_size = %llu\n", + (unsigned long long)snap_id, (unsigned long long)*snap_size); return 0;