Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3582094pxy; Mon, 26 Apr 2021 05:17:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1Xe6Jt57zX2dq1Kxqtia9lP41ThskEjpU8HiXXcs1MhPuWnOlsyNkTrd1wKgrTVkYCN9H X-Received: by 2002:a17:902:d30c:b029:eb:3d5a:ff07 with SMTP id b12-20020a170902d30cb02900eb3d5aff07mr18594893plc.19.1619439420854; Mon, 26 Apr 2021 05:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619439420; cv=none; d=google.com; s=arc-20160816; b=a7ByUosmZULpUMyPA5s1EGYjd2MxVlwmqnfKK+LdV2VQIX2+e5nvIUsaXK8QOhE7X5 dPZjpYn+sDlSkum6NCgGRnxHD1ner+Ogsh34+mwojecFFxtGMonOJdfc84YPIX3qntvc JDo04fdktdNu2SMqvcd31WHFOVeYLhKy+Xi9M1pNccJeNh4zQStbwBG+2HCm9b6BzEce YWCOPHUZUslXK+z0QByy8otmqtRqM9thooN7bMY9tRqi2Z5YnppRWKtOdHJn7ZVvSQD0 V7VDaRd/JzeDf92CTb0A38wPgk9niGHryP8pjQ75EcY31stwQUDaDLJs4czT2jicYXWp HVNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9Aur93L6w9/5uDCnG3cRoYh62EILBVncupYganBLwm4=; b=C+bYS4srOlwshYaIdJ0IbCVrf9FhGA56eSxtYXIKqmGrj7X4E60SbgOXDnCE3DA786 5YCc/SmB/V1MTrpZ1xGPT2vtWIRJSm0J4lhygDzOP4tsCCaqdaZ+9vSNlR/NBEzPJLrl 7UofJnKIdSjX+HaoVYoCLpHqWry+vQowdGLeiMxRYDRDrniiM5p4HTVdJIW6XczPBFFD 38TMjS79dE51CXQvVHXK+TahksE9iM0sncH8L0mp9dTDy5bdpvvkBzcNb2h9Chmc4JZv HHMZ7Jnf57+ssQyPqvuSj/QiOW1wRnoPPoNgCxhXgndbTkmuLOCTYMzj9VDxmQAmc54o wE2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F3R6RPhY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c16si16697269pgw.33.2021.04.26.05.16.47; Mon, 26 Apr 2021 05:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F3R6RPhY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233234AbhDZMQs (ORCPT + 99 others); Mon, 26 Apr 2021 08:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233262AbhDZMQq (ORCPT ); Mon, 26 Apr 2021 08:16:46 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E466FC061756; Mon, 26 Apr 2021 05:16:04 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id d15so12528625ljo.12; Mon, 26 Apr 2021 05:16:04 -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:content-transfer-encoding; bh=9Aur93L6w9/5uDCnG3cRoYh62EILBVncupYganBLwm4=; b=F3R6RPhYXVICKhct7f8L96mfQbCFMH5Xzp/fVam33NSBaDWvJD+d0YWpQkW64nV7gx I8YkEbPUD2hS7QNQ6Ch6MW+36MsV7PrRZzWq87+3IgW/zXUo4uXvK03HQ3khUp9jUx0/ V3XCQbKE3uTSqPaFhOKIPXQo+PBgR/I8xosUNJGhj42qrcVyd98eSU6VHA25jHJjhOQx Tmsc5uI5JNwkC8C9x4iee0bkrjgN2Pge1ffq+vBFtjye1n5Vs/21lKDJ0uGIPCkfIPdS H+4MSJc+HkoePpTSIAewg5PUVaoKjgj7Et02DmK6eLo92K5TKHvuX4VV3VSaGXWOmMwH XIWQ== 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:content-transfer-encoding; bh=9Aur93L6w9/5uDCnG3cRoYh62EILBVncupYganBLwm4=; b=CrAiuL0IXUB75roBhyYuBc6qWw0K+/FcPezldRJh0f79zk27TnwJOmeZxdGUIx6Q1t uLB9XAq68/Q1p/wnEEuv47tO27miC06d/UQuNab2Y1hnnrQMQ8rjkNtKbSyOIY5B4aQo Mao2t01ukQDEuPdYJcdQzmiFoDMKMxDfm6E4ESj0Lw7EQgytGdGgQcXg3+XjTSwcX6Oa QruOHhGO+b4HhvZ9dBRnOj9iguLQeasplRvQHm2UBvu6+H9oMRNA8NfIgdzPC+wjPDZO NpmrwLr5u3uHC4LZQMfbmb0AtvY8cMx/TLchJJy3lAXEhgv6G78N6wcqscHfVnTGW9nQ lkPg== X-Gm-Message-State: AOAM5334+U071ljhhJdiJHwZaE7fDVn6vhC/C9T5Yx4w3V752X218LjK ASgHaSCguKDkW3RHpglSg8i3pqisQVEhJ+CU1Pk9KmVU1GM= X-Received: by 2002:a2e:990b:: with SMTP id v11mr12700046lji.53.1619439363473; Mon, 26 Apr 2021 05:16:03 -0700 (PDT) MIME-Version: 1.0 References: <20210426074935.11131-1-sherry.sun@nxp.com> <20210426074935.11131-3-sherry.sun@nxp.com> In-Reply-To: From: Fabio Estevam Date: Mon, 26 Apr 2021 09:15:51 -0300 Message-ID: Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: fix the potential bug of dereference null return value To: Sherry Sun Cc: Greg KH , "jirislaby@kernel.org" , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021 at 9:09 AM Sherry Sun wrote: > Thanks for your reply. > I guess you mean the of_match_table will not be NULL since it contains co= mpatible, right? > But for the lpuart data -- struct lpuart_soc_data, won=E2=80=99t it meet = the NULL case? such as { .compatible =3D "fsl,imx8qxp-lpuart", }. > Here of_device_id won=E2=80=99t be NULL, but lpuart_soc_data Is NULL. In linux-next we have: static const struct of_device_id lpuart_dt_ids[] =3D { { .compatible =3D "fsl,vf610-lpuart", .data =3D &vf_data, }, { .compatible =3D "fsl,ls1021a-lpuart", .data =3D &ls1021a_data, }, { .compatible =3D "fsl,ls1028a-lpuart", .data =3D &ls1028a_data, }, { .compatible =3D "fsl,imx7ulp-lpuart", .data =3D &imx7ulp_data, }, { .compatible =3D "fsl,imx8qxp-lpuart", .data =3D &imx8qxp_data, }, { /* sentinel */ } }; All compatible entries have a .data field populated. How sdata can be NULL?