summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchal Verma <achalv@nvidia.com>2021-04-15 00:23:26 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2021-08-12 15:24:55 -0400
commit3b96cf0548080dc298fcb380ddef155545c53a1a (patch)
tree8363f68a758e6a4bbab14b9757a61e6b0fb869c4
parent866ba8d085b43f2815bb4621576c3cb1a531922c (diff)
tegra-ahci: Fix potential null ptr dereference.
Condition to check ptr being non-null before use. This fix coverity issue: 9820675 Bug 200741055 Change-Id: I815d79fa899437c0bf24dc96505470b23b7990c1 Signed-off-by: Achal Verma <achalv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2515237 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Dmitry Pervushin <dpervushin@nvidia.com> Reviewed-by: Rahul Jain (SW-TEGRA) <rahuljain@nvidia.com> GVS: Gerrit_Virtual_Submit (cherry picked from commit 940245b31a1569cb4d1227b86a51b2f366714135) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2574549 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/ata/tegra/ahci_tegra.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ata/tegra/ahci_tegra.c b/drivers/ata/tegra/ahci_tegra.c
index aa9cdde9e..cd2602a59 100644
--- a/drivers/ata/tegra/ahci_tegra.c
+++ b/drivers/ata/tegra/ahci_tegra.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/ata/ahci_tegra.c 2 * drivers/ata/ahci_tegra.c
3 * 3 *
4 * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -569,9 +569,11 @@ static void tegra_ahci_unbind(struct work_struct *work)
569 struct ata_port *ap = host->ports[i]; 569 struct ata_port *ap = host->ports[i];
570 unsigned long flags; 570 unsigned long flags;
571 571
572 if (!ap)
573 continue;
572 spin_lock_irqsave(ap->lock, flags); 574 spin_lock_irqsave(ap->lock, flags);
573 if (ap && ((ap->pflags & ATA_PFLAG_LOADING) || 575 if ((ap->pflags & ATA_PFLAG_LOADING) ||
574 (ap->pflags & ATA_PFLAG_INITIALIZING))) { 576 (ap->pflags & ATA_PFLAG_INITIALIZING)) {
575 INIT_DELAYED_WORK(&tegra->work, tegra_ahci_unbind); 577 INIT_DELAYED_WORK(&tegra->work, tegra_ahci_unbind);
576 schedule_delayed_work(&tegra->work, msecs_to_jiffies(1000)); 578 schedule_delayed_work(&tegra->work, msecs_to_jiffies(1000));
577 spin_unlock_irqrestore(ap->lock, flags); 579 spin_unlock_irqrestore(ap->lock, flags);