Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp276990lqb; Thu, 23 May 2024 19:14:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJlXZa1WW4WLtdyfkw2aGlC49CqA2PdUQzOQg6UHZntWUNjABiSTMmiOWvI/8yJlB75bkR5zywNAlQSlUyKyetf5qEy7bYF4w2Y+QGHQ== X-Google-Smtp-Source: AGHT+IEdV3CPu1UoBG4v1vH1zB9JZpFWaA3geGdDf8koHJDRZhnDpC/igsmQLn1se2UBlxTHd248 X-Received: by 2002:a05:6e02:1c8c:b0:36c:4bcc:8df6 with SMTP id e9e14a558f8ab-3737b33f2e3mr8798995ab.32.1716516849859; Thu, 23 May 2024 19:14:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716516849; cv=pass; d=google.com; s=arc-20160816; b=hESjUv/yU6WWuKv3v+cEnfiDrLAxsxwPm5ZNemwQ0mRUDxffiPUU7oUEoHkoMf4JwR hOkgNGpdAUZW0PgoTpngCQg7+q++nlZgBwz9bBo4BeZ26zNAhsDpJV0LqPOK8gsCHNaL QOpWMsXX+ULBEjlnQXg7hLoNeKXsICtI21xnbls0qYT7VjkaBNeO8cXyfimB2iDw1S+/ oDSj8AeaQrPrrwOP3Mjph5j9jWf7XvxRoG9FsGLYb0L0KJkrMeD6j+e1+qTHD6TUxfre Z4nhaWQCHQbNtClyHnBkcG03nSIYZAGLsxN0WeAxog5oEkk3W/24KvRWUu7lr8JnPkQz gw0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=jd7c8VnwZhh78ikfWZy1/DT0+s4OAj8DFKOiLZAPwYU=; fh=9UAODggEPfSbmTe/gpRMjLfpi5F8E+UkRmmlFTHaIMs=; b=L4+Hu+/pwHvPrNgxaiedghiKxaeXoFSV2Xkp8cyXOGOtSEXO55upXO9XkuZmZ/30ly slEzTuj+8Zs8m3zc4GS4XVfl+5kdN/RtvW//kB8mR7+5vA/GqEjCqOeiYCHdG/bdS48p 7j8ZCVS4Xek6nro9MC7+CrwZSxNc6JfoPfMgT7FOBh5xgtNo413iR3W+CevU/eLzZEb6 uHz9uctweFSPeY4R1nP+TObPpLx3ORbKp+UrZAIx8+QfNk/BTknObiEEPlPv5d+U1ZBU GPcwiBZpirB7/gQCtPosYt765VY590Ic3vMOtS9qmx61Nqdf2CY/r88oT3IsYbMhjIue hT6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IjTPaJIA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-188224-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-68221b758a3si373863a12.36.2024.05.23.19.14.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 19:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188224-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IjTPaJIA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-188224-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8664D28238A for ; Fri, 24 May 2024 02:14:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1D662B9C4; Fri, 24 May 2024 02:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IjTPaJIA" Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C04FE81F; Fri, 24 May 2024 02:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716516839; cv=none; b=iWssS+NAhBFb0o9rA2IhXDJcPk1zR5beM84lJbgGjo1p/lbSrodeVvjvuu0LUKt4nspmczHNrww7vy34JexvAq/A/RutnKdVllP20r7xbMYdaqghfZkLJFnyAUNLhbns8vYA2T25lHZsN17wd4KArr4w9hBpHsio3As4au0RIE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716516839; c=relaxed/simple; bh=XkU1tXwZkmKmjxI73pUbqI9HHmRQiTPAwNA9fCGNSfI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WlNouQ43+s+8IVTAKw86UbT+CVYZxGf5BoE/Vag9rC1x2z5VBfSU5tUqwjZzLC4Cu9fo90wWNW1IHseSc4Sa5BTX+omhsKuLIaLVU/lYUS8RGbxYdEeAiUuuAvnzA5B8ErEN8xhah624y6KGYTitjDW+I6Jy5UJpDCOy4pFC784= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IjTPaJIA; arc=none smtp.client-ip=209.85.221.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-4e4f0020ca3so169798e0c.2; Thu, 23 May 2024 19:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716516836; x=1717121636; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jd7c8VnwZhh78ikfWZy1/DT0+s4OAj8DFKOiLZAPwYU=; b=IjTPaJIAIQbVlLZ51/+8Xl/I6fMducSw4D04ysHunsQ2pLLinV8hKcyu8XAiNAoYFp yrV1JUw6jbFt9JDyR1Qh7c+zjBeswjgBxddcjtIEoK0be5qqJ84fVzJllaeEIjQ55w7T tAa4W47wnbe3x3/betmrBcXSyoGYoeB+muzd0RMVw1ApquS/TaVWpcLFZ/ZWy+kLrwjj i61UUrS69F59Y/8D7xcglFMhxHINxwTUwvXso7EnmBG38ZHKyccJe/tMNo5X9oRKXGbR tp845mwt7H2B6eHHMgo0rG5FsVERRTFIDUBOtJUIs5B//w3+X5FemgUN3ufkEwpqZUdX 0Prw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716516836; x=1717121636; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jd7c8VnwZhh78ikfWZy1/DT0+s4OAj8DFKOiLZAPwYU=; b=MWJriONUqE0FpysDg1TA1VpKHMdLzuZ7qvgUAUipwGtB2NJHYV35UcCyWrIkV7C9+x j4QYwJuUi+i05MvNrMli3qVd/tJNK3EhtTAZjdrlR4WM2Y1IMv+Ox42VMeQogTacIoVc X0QsqcIoXC0L/xFt5ZTi+1upO6gjQVYM1ulQRxfU+ZsVYGqwjsIwOhMUDMhN65+s048f dtXjqMIYpGqv9Pnbajb8GC6hLLA1CmswUhGzIcrwuu63twaBlr12Hd6W8TwBa7MzwcMR z30RT1pdq9PqIIpnzQ/Lh2ixRR4MbniNcf4dnKWLjHbv+icD8GD2fWZZ+B622tiMBwo8 +L/w== X-Forwarded-Encrypted: i=1; AJvYcCXigCVoi98J2fdyewZs9XxoYwXJY4STCzoHd40Cey6lmLIzoVIolDjZwW8EpeNTvqphpvBQL7j0SFYf9nuHKHAhTuQcnvmnFDN7Sq99 X-Gm-Message-State: AOJu0Yx2ejhpHRDDY4j9ilKBZN/WlZZ9ytzldhaA3mCQOu3PbKugzrCw UfbQAjyCW4nykZDJMvBNFyqcN9BQ2JhvTO6TrXYFTmOabw7wyzBBre2X2wGpdTVc3uljWNoov7w 1nWhVYLdqH9CwQCTEf+TRTbYcoeI= X-Received: by 2002:a05:6122:168e:b0:4df:261c:fc0c with SMTP id 71dfb90a1353d-4e4f02e650cmr1092154e0c.13.1716516836500; Thu, 23 May 2024 19:13:56 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240523092608.874986-1-shichaorai@gmail.com> In-Reply-To: From: shichao lai Date: Fri, 24 May 2024 10:13:45 +0800 Message-ID: Subject: Re: [PATCHv2] Check whether divisor is non-zero before division To: Alan Stern , gregkh@linuxfoundation.org, oneukum@suse.com Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org, xingwei lee , yue sun Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 24, 2024 at 12:30=E2=80=AFAM Alan Stern wrote: > > Good work! So the problem is that the driver believes the status[0] & > 0x08 test. > > The way to fix this is to add an "initialized" flag to the alauda_info > structure. Then alauda_check_media() should call alauda_init_media() if > the 0x08 bit is set in status[0] _or_ if info->initialized is 0. And of > course, alauda_check_media() should then set info->initialized to 1 if > the alauda_init_media() call succeeds. > > Would you like to write and test a patch that does this? > > Alan Stern I tried to do this. And the workflow can enter alauda_init_media(), but there are still many conditions to satisfy in alauda_init_media(). Unfortunately alauda_init_media() stop and return here before initializing uzonesize: if (data[0] !=3D 0x14) { usb_stor_dbg(us, "Media not ready after ack\n"); return USB_STOR_TRANSPORT_ERROR; } The data[0] is status[0] showed before, and it was 0x0036. I am not familiar with the status code of alauda. How can I deal with this condition? Is it ok to pass this condition when info->initialized =3D=3D false, even if the data[0] !=3D 0x14?