Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp306047imd; Fri, 26 Oct 2018 08:50:06 -0700 (PDT) X-Google-Smtp-Source: AJdET5cglcl1elZJ/8pSe95VLndMWMaK6LCFa6LbClWbaZkQYylARAIcyHbZGW5CS//ncQr5sNfq X-Received: by 2002:a63:81c7:: with SMTP id t190mr3990947pgd.393.1540569006164; Fri, 26 Oct 2018 08:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540569006; cv=none; d=google.com; s=arc-20160816; b=aL99V44b1ZGd+sY/cAwZhmoACQBHae726Hf6MG+UcM1wtJEpCVvHUCCdllsqpAHoT9 Vy8KMe9HLAW0Ft4x+jSi5Y0GpqfAZ8U/UMDDY2zvD8W7GJjCXB0yYgsXqnT4Y2+hxI8T 8d22VZzsS92QOaDFtK4+SyaS3DuJpNek1HQZ5fnaV6EOSHGduFLuR8irck5Nlfk9qvRm 4CnuEg4GJvU5sAYwIEXTN+9uFxt5w4P13Eh8aKiQ9GiwukVRL5keVKDtw0VbeY0qxX61 fvj8a0s1dCnPipg09F7k1MhtaLe+YjqaNJ7+kH6KeFgq6uNysDlpQxrOz7BKuEyfvjLe Jwcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=12bmE5QnwITRe19O+4Lh8FzmnBXQCECHHswUc0rYW9I=; b=Vp7hiskSnM4LCQ3f3eo0O8Bc7wqcMFrD2eLJCdVpOmNL2/87XIJa0wT3EH9REmj0Yw axJMTpGl138fE6akd1vAPwjBZ4ioueaazV2O4qjRzOQjJlrUY56gKDvoIzfD3FB8dNBv //5TQizbDq9Hzd+gA2VhupUaUmzEm3NDxTUkVpRrTXv7zkEliXliv29A4hNHW1hCZLLq 0ndwr4EDXZACNI/5jcLx+kUkOWdQy0jwknSRTnYx47md3p6Kclxok0uzstQHqWMOCaBu KIQ3DJLzM09wsaiFJnA9U6DEQAaHhUXJXYoNkAP61joIvTZcWNvuNFW6LdITFKgIcUes VHjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bkt3CilG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w33-v6si7628261pga.590.2018.10.26.08.49.49; Fri, 26 Oct 2018 08:50:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bkt3CilG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727436AbeJ0A04 (ORCPT + 99 others); Fri, 26 Oct 2018 20:26:56 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:54567 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726113AbeJ0A04 (ORCPT ); Fri, 26 Oct 2018 20:26:56 -0400 Received: by mail-it1-f196.google.com with SMTP id l191-v6so2055259ita.4; Fri, 26 Oct 2018 08:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=12bmE5QnwITRe19O+4Lh8FzmnBXQCECHHswUc0rYW9I=; b=Bkt3CilGSZANlYi1+AqA15/MuOk6WAtGe5lzuk0LSwRpJuIAqvcCf5gDDfqdPgLU41 c/o1cOTsssDyHPMA3FuQJKxbgtczj7yNMftO+91ajSfk3AqllaS0ycUDkeQMl6PUntor UTG5os7PuXcFcdGtwxm//IhiUm1ZyCoqxg1HNyFZwVTLK1NriANRrFce175rCnPnHV9x x6u9Ekoxw0jN6iG12tJwqV5o5Bs2WsCHgDArykaS23UoV25RkjVQeBiCkEYqxYWyc/VG b9MLyaIcxPdaoq3zVvuYuKAbUF/pT6UJJfYZ1k3Oe71s8aH4nV2K9sO8w8ryYSCyPGpp fa+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=12bmE5QnwITRe19O+4Lh8FzmnBXQCECHHswUc0rYW9I=; b=VMI0sjjBXtXjoxYhgCFsSAa9enp/yBD3oflLa9cb+S39nsg9SyLp8nJLGQGF1n/JEi MHxlcJWenUlf8IfhrJkNJG52L7cw+pDz3Nb0STI1GPy7tWaCOx8Y5pLFuXNN6bYDPCi2 SP4OoOT/6fTi7cLEDizNSTGW+ti1l+rGOGneL+KRHupZrP3ylUSXBYKrfyxj4RGLtSYV wZiSI4+PWpzORbbHhaYYvXeKBYsFzqj9E5mKIrx9HVkllBNklZSNl7GB2yZyMSFiQwz2 F5IrYtngPOL600kgt+ephPg71tomVziceemX/hHoqCHXPKk6dLzJ++qsGmeBlVBcrfoj 3mrw== X-Gm-Message-State: AGRZ1gLLD4+eV8iiWs2mik2ysaIV5xC2G5yWy44FdMMH9Ah9rszJXS86 okR2xrF8IXZcAesQvBCO53PtBAB9NU3GtCXtkSc= X-Received: by 2002:a02:8a74:: with SMTP id e49-v6mr2978673jal.81.1540568962339; Fri, 26 Oct 2018 08:49:22 -0700 (PDT) MIME-Version: 1.0 References: <1540567279.66186.99.camel@acm.org> In-Reply-To: <1540567279.66186.99.camel@acm.org> From: Kyungtae Kim Date: Fri, 26 Oct 2018 11:49:10 -0400 Message-ID: Subject: Re: [PATCH] floppy: Avoid memory access beyond the array bounds in setup_rw_floppy() To: bvanassche@acm.org Cc: Jens Axboe , jikos@kernel.org, Byoungyoung Lee , DaeRyong Jeong , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thank you for your reply. > Against which kernel tree did you prepare this patch? Just above the code > you want to insert I found the following: > > if (ptr->cmd_count > 33) ... Yes, I saw that code as well. But I find out there is no more additional code relevant to it. So I guess, that is for like reserved ones for the future work (e.g., RESTORE). And such code cannot solve this crash issue because the crash happens even when cmd_count is less than 33. > or not? Anyway, I don't think it makes sense first to compare cmd_count against > 33 and next to compare it against 16 ... I agree. So far, seems that removing if (ptr->cmd_count > 33) looks better. Please let me know if you have better ideas. > This comparison looks suspicious to me. Almost every comparison of the type > "... > ARRAY_SIZE()" I have seen so far was wrong and should be changed into > "... >= ARRAY_SIZE()" instead. Well, let me check this part again. Thanks, Kyungtae Kim