From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdFANQJ (ORCPT ); Thu, 1 Jun 2017 09:16:09 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:32883 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbdFANQI (ORCPT ); Thu, 1 Jun 2017 09:16:08 -0400 MIME-Version: 1.0 In-Reply-To: <20170601150839.08fdb556@endymion> References: <20170601150839.08fdb556@endymion> From: Andy Shevchenko Date: Thu, 1 Jun 2017 16:16:05 +0300 Message-ID: Subject: Re: [PATCH] firmware: dmi: Check DMI structure length To: Jean Delvare Cc: LKML , Dmitry Torokhov , Mika Westerberg , Linus Walleij Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 1, 2017 at 4:08 PM, Jean Delvare wrote: > Before accessing DMI data to record it for later, we should ensure > that the DMI structures are large enough to contain the data in > question. > - const u8 *d = (u8 *) dm + index; > + const u8 *d; > + d = (u8 *) dm + index; I think you may leave this as is and make it compiler's burden to optimize. > - const u8 *d = (u8 *) dm + index; > + const u8 *d; > + d = (u8 *) dm + index; Ditto. > - int i, count = *(u8 *)(dm + 1); > + int i, count; > + count = *(u8 *)(dm + 1); Ditto. -- With Best Regards, Andy Shevchenko