From: David van Moolenbroek Date: Fri, 27 Jul 2012 14:46:05 +0000 (+0000) Subject: ahci: resolve Coverity warnings X-Git-Tag: v3.2.1~427 X-Git-Url: http://zhaoyanbai.com/repos/named-checkzone.html?a=commitdiff_plain;h=d75ef5a05c8033f3d8183c16b3a53dd859bc6d49;p=minix.git ahci: resolve Coverity warnings --- diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index b5ef43010..c0822b7cb 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -242,7 +242,7 @@ static int atapi_exec(struct port_state *ps, int cmd, /* Execute an ATAPI command. Return OK or error. */ cmd_fis_t fis; - prd_t prd; + prd_t prd[1]; int nr_prds = 0; assert(size <= AHCI_TMP_SIZE); @@ -258,13 +258,13 @@ static int atapi_exec(struct port_state *ps, int cmd, if (!write && (ps->flags & FLAG_USE_DMADIR)) fis.cf_feat |= ATA_FEAT_PACKET_DMADIR; - prd.vp_addr = ps->tmp_phys; - prd.vp_size = size; + prd[0].vp_addr = ps->tmp_phys; + prd[0].vp_size = size; nr_prds++; } /* Start the command, and wait for it to complete or fail. */ - port_set_cmd(ps, cmd, &fis, packet, &prd, nr_prds, write); + port_set_cmd(ps, cmd, &fis, packet, prd, nr_prds, write); return port_exec(ps, cmd, ahci_command_timeout); } @@ -2196,7 +2196,7 @@ static void ahci_set_mapping(void) /* See if the user specified a custom mapping. Unlike all other * configuration options, this is a per-instance setting. */ - strcpy(key, "ahci0_map"); + strlcpy(key, "ahci0_map", sizeof(key)); key[4] += ahci_instance; if (env_get_param(key, val, sizeof(val)) == OK) {