From patchwork Wed Apr 25 18:45:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Wang X-Patchwork-Id: 155056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AADA0B6FD1 for ; Thu, 26 Apr 2012 04:46:51 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SN7Dn-00039N-6W; Wed, 25 Apr 2012 18:45:47 +0000 Received: from mail-qc0-f177.google.com ([209.85.216.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SN7Dh-00038j-Ob for linux-mtd@lists.infradead.org; Wed, 25 Apr 2012 18:45:42 +0000 Received: by qcsu28 with SMTP id u28so314167qcs.36 for ; Wed, 25 Apr 2012 11:45:40 -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:x-mailer:in-reply-to:references; bh=Md3D0cokcUn/T7WlJT54xnAakeTIwFahMdGF+il9W0c=; b=HG2Y8QUuZrJex5O5eM5zfNu8/C5svNLf8f3G/A/BtuUxsSjubz4xiaJ+x9CAESDoh7 emcgPxOYuvtaeoPPrd0RK59PSI3daWYgfuuHRUYKlEaRgnnZ0F6C0IEtBHG66IEbHfX3 gJQps6qfbN4qpqHo0wmBmvmCg6mT5MiPvpTEM+S4XUwuHD/xy5sxkBcbOfAAM0jBmlZ1 58oIpV/v/hp8XkDh4H4mj7U+iU7Vx1foXfHhrtLY3xhNIhFkbrN6i1B1Im41gDU8pkj+ mqF9CbwC61YO7cHmV3fPBuW1N7aLZMoX8nqweSfy7JtDeiAHkicAxdjb917L/kM2Bg4L D+Fg== Received: by 10.224.101.72 with SMTP id b8mr3005814qao.53.1335379540780; Wed, 25 Apr 2012 11:45:40 -0700 (PDT) Received: from localhost.localdomain (hchen.csail.mit.edu. [18.26.5.5]) by mx.google.com with ESMTPS id q11sm1569736qap.18.2012.04.25.11.45.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Apr 2012 11:45:40 -0700 (PDT) From: Xi Wang To: David Woodhouse Subject: [PATCH v2 2/2] jffs2: refactor csize usage in jffs2_do_read_inode_internal() Date: Wed, 25 Apr 2012 14:45:23 -0400 Message-Id: <1335379523-31415-2-git-send-email-xi.wang@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335379523-31415-1-git-send-email-xi.wang@gmail.com> References: <1335379523-31415-1-git-send-email-xi.wang@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (xi.wang[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-mtd@lists.infradead.org, Xi Wang , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Replace the verbose `je32_to_cpu(latest_node->csize)' with a shorter `csize'. Signed-off-by: Xi Wang Cc: Artem Bityutskiy --- fs/jffs2/readinode.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 9897f38..3833d74 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c @@ -1272,19 +1272,19 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, jffs2_do_clear_inode(c, f); return -ENAMETOOLONG; } - f->target = kmalloc(je32_to_cpu(latest_node->csize) + 1, GFP_KERNEL); + f->target = kmalloc(csize + 1, GFP_KERNEL); if (!f->target) { - JFFS2_ERROR("can't allocate %d bytes of memory for the symlink target path cache\n", je32_to_cpu(latest_node->csize)); + JFFS2_ERROR("can't allocate %u bytes of memory for the symlink target path cache\n", csize); mutex_unlock(&f->sem); jffs2_do_clear_inode(c, f); return -ENOMEM; } ret = jffs2_flash_read(c, ref_offset(rii.latest_ref) + sizeof(*latest_node), - je32_to_cpu(latest_node->csize), &retlen, (char *)f->target); + csize, &retlen, (char *)f->target); - if (ret || retlen != je32_to_cpu(latest_node->csize)) { - if (retlen != je32_to_cpu(latest_node->csize)) + if (ret || retlen != csize) { + if (retlen != csize) ret = -EIO; kfree(f->target); f->target = NULL; @@ -1293,7 +1293,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, return ret; } - f->target[je32_to_cpu(latest_node->csize)] = '\0'; + f->target[csize] = '\0'; dbg_readinode("symlink's target '%s' cached\n", f->target); }