From patchwork Mon Aug 6 18:03:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1280621 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D8724DF288 for ; Mon, 6 Aug 2012 18:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744Ab2HFSDf (ORCPT ); Mon, 6 Aug 2012 14:03:35 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:39424 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753685Ab2HFSDf (ORCPT ); Mon, 6 Aug 2012 14:03:35 -0400 Received: by pbbrr13 with SMTP id rr13so2904653pbb.19 for ; Mon, 06 Aug 2012 11:03:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=lUzskd/E+FQDsrx8WMtd0Wil31T3zt30ymr61CAv2Fs=; b=i/oWKvE6+HAw2H2OSSntE+2/YrW2Zk+zT7k1UaXSCR8QHXmkEIFXX2ucb3ENsgSudp wVr4paajmoVD8X4+0LIXwzinCa8xrEOPmeqOkloscTBXALbTN/bW4X3zkZoVL51l1rW2 ObQi/LqPFKQ1Lzs4jmjtC7jGuVeHUS8/p4vfTm5h4KG95KCpyG9BCV0DcJb6FF8k+OdV 2PL3tOlTPMgEFI98AZcIJYwElrAVqSiyDSm32SoFisl7p9mdt2X2I7VYx48gmSS6lhXf KfPqArycP+/0hjixYu8liiA7SUaMcp9NBfEYbdMd5ejq/4OCcGB2sMak/5mEMIONhahz wA4A== Received: by 10.68.241.41 with SMTP id wf9mr21019375pbc.41.1344276213786; Mon, 06 Aug 2012 11:03:33 -0700 (PDT) Received: from ?IPv6:2607:f298:a:607:3c9c:52cb:843e:71a9? ([2607:f298:a:607:3c9c:52cb:843e:71a9]) by mx.google.com with ESMTPS id rz10sm9378151pbc.32.2012.08.06.11.03.32 (version=SSLv3 cipher=OTHER); Mon, 06 Aug 2012 11:03:32 -0700 (PDT) Message-ID: <502006F3.5030609@inktank.com> Date: Mon, 06 Aug 2012 11:03:31 -0700 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 1/3] rbd: make snap_names_len a u64 References: <50200691.3040006@inktank.com> In-Reply-To: <50200691.3040006@inktank.com> X-Gm-Message-State: ALoCoQkJRNlGUB9Co0cY3jpl5rdZe/4O7XeRWAJJHrduG2f2YcmkkiiYL1BvJAAlGQYA12RMWiow Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The snap_names_len field of an rbd_image_header structure is defined with type size_t. That field is used as both the source and target of 64-bit byte-order swapping operations though, so it's best to define it with type u64 instead. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 3 ++- 1 file changed, 2 insertions(+), 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 Index: b/drivers/block/rbd.c =================================================================== --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -81,7 +81,7 @@ struct rbd_image_header { __u8 crypt_type; __u8 comp_type; struct ceph_snap_context *snapc; - size_t snap_names_len; + u64 snap_names_len; u32 total_snaps; char *snap_names; @@ -511,6 +511,7 @@ static int rbd_header_from_disk(struct r if (snap_count) { header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); + BUG_ON(header->snap_names_len > (u64) SIZE_MAX); header->snap_names = kmalloc(header->snap_names_len, GFP_KERNEL); if (!header->snap_names)