aboutsummaryrefslogtreecommitdiff
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorSerge Semin2022-09-09 22:36:06 +0300
committerDamien Le Moal2022-09-17 01:39:26 +0900
commit3c132ea6508b34956e5ed88d04936983ec230601 (patch)
tree6c87fbdbb854fcaaf8955454efe70e5cb130a808 /drivers/ata/libata-scsi.c
parente28b3abf8020a884bd3b7758ea8915365af8fadf (diff)
ata: libahci_platform: Sanity check the DT child nodes number
Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation. Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value. Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
0 files changed, 0 insertions, 0 deletions