From patchwork Wed Jul 11 14:00:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1182651 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 13611DF25A for ; Wed, 11 Jul 2012 14:00:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757825Ab2GKOAi (ORCPT ); Wed, 11 Jul 2012 10:00:38 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:55042 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757594Ab2GKOAh (ORCPT ); Wed, 11 Jul 2012 10:00:37 -0400 Received: by ghrr11 with SMTP id r11so1224069ghr.19 for ; Wed, 11 Jul 2012 07:00:37 -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=5yw18X00Da2/cofE6xuOgz7ftH7GRu7OL8747P+/1g8=; b=A5/nVFrtSSUWyWEv77iGfiOtIiBv0N2wu1wkROlRRxWyr4vwLsOIommENlAeBFbev6 FjSvmuzMWrHoQWhAHARlkUB2rcQ0fWJN2lErhtQeEL5K2DhkCOqNN8HtryipY30dugWA X4psBGX2IBmLjbsS/LE5uoenum74oklSH27zWW8GTg276uAzb1SOTcgpt/rlHhXKs0hN USt68WNYnw4WfDN3F+GIrzoY3BcFQEY8x2jP9lXlH4oA4R7u8gDYxgXOji+YbOJZzrZc cPL3GzYZ0FVyNSmhxu9Y6YkLjFldvxjA2w3a1OnvLXK2P0HDtMnxMqKq5GeIe2UTn6fu M1LQ== Received: by 10.236.182.67 with SMTP id n43mr55633848yhm.66.1342015237163; Wed, 11 Jul 2012 07:00:37 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id n43sm3263129yhm.7.2012.07.11.07.00.33 (version=SSLv3 cipher=OTHER); Wed, 11 Jul 2012 07:00:34 -0700 (PDT) Message-ID: <4FFD8701.6020203@inktank.com> Date: Wed, 11 Jul 2012 09:00:33 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 01/16] libceph: fix off-by-one bug in ceph_encode_filepath() References: <4FFD847C.7070205@inktank.com> In-Reply-To: <4FFD847C.7070205@inktank.com> X-Gm-Message-State: ALoCoQlcIHBhBeA6X/Btfoadjc74cVYmzwP7udO6aLR2KXWF8vCC7a0ZY7JqXtpxvPE0BqJRD7Yl Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org There is a BUG_ON() call that doesn't account for the single byte structure version at the start of an encoded filepath in ceph_encode_filepath(). Fix that. Signed-off-by: Alex Elder Reviewed-by: Yehuda Sadeh Reviewed-by: Josh Durgin --- include/linux/ceph/decode.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) ceph_encode_32(p, len); diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h index d8615de..bcbd66c 100644 --- a/include/linux/ceph/decode.h +++ b/include/linux/ceph/decode.h @@ -151,7 +151,7 @@ static inline void ceph_encode_filepath(void **p, void *end, u64 ino, const char *path) { u32 len = path ? strlen(path) : 0; - BUG_ON(*p + sizeof(ino) + sizeof(len) + len > end); + BUG_ON(*p + 1 + sizeof(ino) + sizeof(len) + len > end); ceph_encode_8(p, 1); ceph_encode_64(p, ino);