From patchwork Tue Oct 27 16:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11860865 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E03D6A2 for ; Tue, 27 Oct 2020 16:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 166EF22275 for ; Tue, 27 Oct 2020 16:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811810AbgJ0Qmi (ORCPT ); Tue, 27 Oct 2020 12:42:38 -0400 Received: from aposti.net ([89.234.176.197]:47482 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1802032AbgJ0Qmh (ORCPT ); Tue, 27 Oct 2020 12:42:37 -0400 From: Paul Cercueil To: Bin Liu Cc: Greg Kroah-Hartman , Tony Lindgren , od@zcrc.me, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Maarten ter Huurne Subject: [RESEND PATCH 2/4] usb: musb: Fix NULL check on struct musb_request field Date: Tue, 27 Oct 2020 16:41:58 +0000 Message-Id: <20201027164200.18602-3-paul@crapouillou.net> In-Reply-To: <20201027164200.18602-1-paul@crapouillou.net> References: <20201027164200.18602-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The 'request' variable is a pointer to the 'request' field of the struct musb_request 'req' pointer. It only worked until now because the 'request' field is the first one in the musb_request structure, but as soon as that changes, the check will be invalid. Fix it preventively by doing the NULL-check on the 'req' pointer instead. Signed-off-by: Paul Cercueil Suggested-by: Maarten ter Huurne Acked-by: Tony Lindgren --- drivers/usb/musb/musb_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index f62ffaede1ab..ef374d4dd94a 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -451,7 +451,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) return; } - if (request) { + if (req) { trace_musb_req_tx(req);