From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757507Ab3BMNr3 (ORCPT ); Wed, 13 Feb 2013 08:47:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48607 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756138Ab3BMNrQ (ORCPT ); Wed, 13 Feb 2013 08:47:16 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1360130301-9031-1-git-send-email-jlee@suse.com> References: <1360130301-9031-1-git-send-email-jlee@suse.com> To: "Lee, Chun-Yi" Cc: dhowells@redhat.com, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Josh Boyer , Randy Dunlap , Herbert Xu , "David S. Miller" Subject: Re: [PATCH] X.509: Support parse long form of length octets in Authority Key Identifier Date: Wed, 13 Feb 2013 13:47:00 +0000 Message-ID: <18786.1360763220@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lee, Chun-Yi wrote: > Signed-off-by: Lee, Chun-Yi Without the comma, please. > + /* Short Form length */ > + if (vlen <= 127) { > + > + if (v[1] != vlen - 2 || There's an unnecessary blank line there. I would also move the comment inside the if-body. > + int sub = v[1] - 0x80; I recommend you use an unsigned int or size_t variable. Also, you should use ASN1_INDEFINITE_LENGTH rather than writing 0x80 and 127. > + v += 4; > + key_len = v[3]; Are you sure that is correct? You altered v before doing v[3]. I would stick with key_len = vlen - 4. > + /* calculate the length from subsequent octet */ "... octets". > + seq_len |= v[2 + i]; Add 2 to v before entering the loop. > + /* check vlen should not less then length of keyid */ vlen should be exactly equal to key id, shouldn't it? Leastways, that's what you're checking... > + v += (4 + sub); > + key_len = v[3 + sub]; Again, this doesn't look right. Besides, you should be able to work out key_len from vlen, subtracting the metadata size. David