Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754674AbYCLUKt (ORCPT ); Wed, 12 Mar 2008 16:10:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751694AbYCLUKh (ORCPT ); Wed, 12 Mar 2008 16:10:37 -0400 Received: from khc.piap.pl ([195.187.100.11]:48882 "EHLO khc.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbYCLUKg (ORCPT ); Wed, 12 Mar 2008 16:10:36 -0400 To: Jan Engelhardt Cc: Jeff Garzik , Andrew Morton , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] Re: WAN: new PPP code for generic HDLC References: From: Krzysztof Halasa Date: Wed, 12 Mar 2008 21:10:31 +0100 In-Reply-To: (Jan Engelhardt's message of "Wed\, 12 Mar 2008 20\:38\:01 +0100 \(CET\)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1017 Lines: 29 Jan Engelhardt writes: >>+ /* LCP only */ >>+ if (pid == PID_LCP) >>+ switch (cp->code) { >>+ case LCP_PROTO_REJ: >>+ pid = ntohs(*(__be16*)skb->data); > > What if skb->data happens to be unaligned (can that even happen?) It can't if the hdlc header is 32-bit aligned... however, I can now see the above is buggy, skb->data doesn't point to the protocol field. Unused code paths :-( > -static const char *code_names[CP_CODES] = {"0", "ConfReq", "ConfAck", > +static const char *const code_names[] = {"0", "ConfReq", "ConfAck", > "ConfNak", "ConfRej", "TermReq", > "TermAck", "CodeRej", "ProtoRej", > "EchoReq", "EchoReply", "Discard"}; The explicit sizes are there as a prevention. Thanks. -- Krzysztof Halasa -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/