hpsa: correct off-by-one sizing of chained SG block
authorWebb Scales <webbnh@hp.com>
Fri, 14 Nov 2014 23:26:43 +0000 (17:26 -0600)
committerChristoph Hellwig <hch@lst.de>
Thu, 20 Nov 2014 08:11:23 +0000 (09:11 +0100)
Correct the size calculation of the chained SG block

Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Webb Scales <webbnh@hp.com>
Reviewed-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Reviewed-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/hpsa.c

index f0984c62bec356b4db569a571e5b1d06ce2ec540..4ca94a5373d3efbdd2c0764610b1bf5908a720ee 100644 (file)
@@ -6321,11 +6321,11 @@ static void hpsa_find_board_params(struct ctlr_info *h)
        h->max_cmd_sg_entries = 31;
        if (h->maxsgentries > 512) {
                h->max_cmd_sg_entries = 32;
-               h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1;
+               h->chainsize = h->maxsgentries - h->max_cmd_sg_entries;
                h->maxsgentries--; /* save one for chain pointer */
        } else {
-               h->maxsgentries = 31; /* default to traditional values */
                h->chainsize = 0;
+               h->maxsgentries = 31; /* default to traditional values */
        }
 
        /* Find out what task management functions are supported and cache */