From e78aba2587be9e79e73ba3275b6c9b2de3c5c71a Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 6 Jul 2011 03:10:08 +0200 Subject: Fix segmentation failure in DMA access mode --- cli.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli.c b/cli.c index 6eb9305..d323f3a 100644 --- a/cli.c +++ b/cli.c @@ -1013,7 +1013,11 @@ int main(int argc, char **argv) { if (addr) { if ((!strncmp(addr, "dma", 3))&&((addr[3]==0)||isnumber(addr+3))) { if ((type)&&(amode != ACCESS_DMA)) Usage(argc, argv, "Conflicting access modes, the DMA read is requested, but access type is (%s)", type); - if ((addr[3] != 0)&&(strcmp(addr + 3, bank))) Usage(argc, argv, "Conflicting DMA channels are specified in read parameter (%s) and bank parameter (%s)", addr + 3, bank); + if (bank) { + if ((addr[3] != 0)&&(strcmp(addr + 3, bank))) Usage(argc, argv, "Conflicting DMA channels are specified in read parameter (%s) and bank parameter (%s)", addr + 3, bank); + } else { + if (addr[3] == 0) Usage(argc, argv, "The DMA channel is not specified"); + } dma = atoi(addr + 3); amode = ACCESS_DMA; } else if ((!strncmp(addr, "bar", 3))&&((addr[3]==0)||isnumber(addr+3))) { -- cgit v1.2.3