]> Zhao Yanbai Git Server - minix.git/commitdiff
ahci: resolve Coverity warnings
authorDavid van Moolenbroek <david@minix3.org>
Fri, 27 Jul 2012 14:46:05 +0000 (14:46 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 30 Jul 2012 12:10:08 +0000 (12:10 +0000)
drivers/ahci/ahci.c

index b5ef43010d527a9aa240b75ae7f64c5dbecc25fc..c0822b7cb4068af0b064817f2242e421c341f6d0 100644 (file)
@@ -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) {