From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754779AbcGUVR1 (ORCPT ); Thu, 21 Jul 2016 17:17:27 -0400 Received: from mail-yw0-f181.google.com ([209.85.161.181]:33483 "EHLO mail-yw0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754119AbcGUVRW (ORCPT ); Thu, 21 Jul 2016 17:17:22 -0400 Date: Thu, 21 Jul 2016 17:17:14 -0400 From: Tejun Heo To: tom.ty89@gmail.com Cc: hare@suse.de, sergei.shtylyov@cogentembedded.com, arnd@arndb.de, sfr@canb.auug.org.au, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org Subject: Re: [PATCH resend 3/5] libata-scsi: fix overflow in mode page copy Message-ID: <20160721211714.GE23759@htj.duckdns.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Jul 22, 2016 at 02:41:52AM +0800, tom.ty89@gmail.com wrote: > From: Tom Yan > > ata_mselect_*() would initialize a char array for storing a copy of > the current mode page. However, if char was actually signed char, > overflow could occur. Do you mean sign extension? > For example, `0xff` from def_control_mpage[] would be "truncated" > to `-1`. This prevented ata_mselect_control() from working at all, > since when it did the read-only bits check, there would always be > a mismatch. Heh, the description doesn't really make sense. Are you talking about something like the following? char ar[N]; int i; i = ar[x]; if (i == 0xff) asdf; If so, the description isn't quite right. Thanks. -- tejun