From 276c8e0e69da0610a72dce720e8fdaf173f7c439 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 18 Dec 2017 18:36:02 +0000 Subject: [PATCH] Corrected some variables preinitialization. --- DiscImageChef.Device.Report/ata_report.c | 2 +- DiscImageChef.Device.Report/mmc_report.c | 10 ++++------ DiscImageChef.Device.Report/ssc_report.c | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/DiscImageChef.Device.Report/ata_report.c b/DiscImageChef.Device.Report/ata_report.c index 03727a1f..4b133d4a 100644 --- a/DiscImageChef.Device.Report/ata_report.c +++ b/DiscImageChef.Device.Report/ata_report.c @@ -328,7 +328,7 @@ void AtaReport(int fd, xmlTextWriterPtr xmlWriter) xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "UnformattedBPS", "%u", le16toh(identify->UnformattedBPS)); - uint64_t blocks; + uint64_t blocks = 0; if(identify->Cylinders > 0 && identify->Heads > 0 && identify->SectorsPerTrack != 0) { diff --git a/DiscImageChef.Device.Report/mmc_report.c b/DiscImageChef.Device.Report/mmc_report.c index 53637c3f..f8dd24c7 100644 --- a/DiscImageChef.Device.Report/mmc_report.c +++ b/DiscImageChef.Device.Report/mmc_report.c @@ -1208,11 +1208,11 @@ void MmcReport(int fd, xmlTextWriterPtr xmlWriter, unsigned char *cdromMode) xmlTextWriterStartElement(xmlWriter, BAD_CAST "ModeSense6Data"); xmlTextWriterWriteBase64(xmlWriter, buffer, 0, *(buffer + 0) + 1); xmlTextWriterEndElement(xmlWriter); - if(!decMode->decoded) + if(decMode == NULL || !decMode->decoded) decMode = DecodeMode6(buffer, 0x05); } - if(decMode->decoded) + if(decMode != NULL && decMode->decoded) { xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "MediumType", "%d", decMode->Header.MediumType); if(decMode->Header.descriptorsLength > 0) @@ -1305,7 +1305,7 @@ void MmcReport(int fd, xmlTextWriterPtr xmlWriter, unsigned char *cdromMode) } // All BDs but BD-ROM - if(i >= 1 || i <= 4) + if(i >= 1 && i <= 4) { printf("Querying BD DDS...\n"); xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "CanReadDDS", "%s", @@ -1376,7 +1376,7 @@ void MmcReport(int fd, xmlTextWriterPtr xmlWriter, unsigned char *cdromMode) } // All BDs - if(i >= 16 && i <= 5) + if(i >= 5 && i <= 16) { printf("Querying BD Disc Information...\n"); xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "CanReadDiscInformation", "%s", @@ -1758,8 +1758,6 @@ void MmcReport(int fd, xmlTextWriterPtr xmlWriter, unsigned char *cdromMode) sense[13] == 0x00) xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "SupportsReadLong16", "%s", "true"); - int i; - if(supportsReadLong10 && blockSize == longBlockSize) { error = ReadLong10(fd, &buffer, &sense, FALSE, FALSE, 0, 37856); diff --git a/DiscImageChef.Device.Report/ssc_report.c b/DiscImageChef.Device.Report/ssc_report.c index 163770af..e9443537 100644 --- a/DiscImageChef.Device.Report/ssc_report.c +++ b/DiscImageChef.Device.Report/ssc_report.c @@ -198,11 +198,11 @@ void SscReport(int fd, xmlTextWriterPtr xmlWriter) xmlTextWriterStartElement(xmlWriter, BAD_CAST "ModeSense6Data"); xmlTextWriterWriteBase64(xmlWriter, buffer, 0, *(buffer + 0) + 1); xmlTextWriterEndElement(xmlWriter); - if(!decMode->decoded) + if(decMode == NULL || !decMode->decoded) decMode = DecodeMode6(buffer, 0x01); } - if(decMode->decoded) + if(decMode != NULL && decMode->decoded) { xmlTextWriterWriteFormatElement(xmlWriter, BAD_CAST "MediumType", "%d", decMode->Header.MediumType); if(decMode->Header.descriptorsLength > 0)