From d80a1943a8ddb184de2a4e78ba3efc0eafb5e133 Mon Sep 17 00:00:00 2001 From: "Jason E. Hale" Date: Wed, 15 May 2024 17:58:18 -0400 Subject: [PATCH] sysutils/cdrdao: Fix zero length DMA with ata(4) Fix zero length DMA transfer attempted failures with the ata(4) driver. This does not seem to affect users of the ahci(4) driver. While here, convert bzero/bcopy to memset/memmove, respectively. PR: 277115 Reported by: Benjamin Jacobs --- sysutils/cdrdao/Makefile | 2 +- .../files/patch-dao_ScsiIf-freebsd-cam.cc | 29 +++++++++++++++++++ .../cdrdao/files/patch-trackdb_FormatMp3.cc | 11 +++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 sysutils/cdrdao/files/patch-dao_ScsiIf-freebsd-cam.cc create mode 100644 sysutils/cdrdao/files/patch-trackdb_FormatMp3.cc diff --git a/sysutils/cdrdao/Makefile b/sysutils/cdrdao/Makefile index 9bcc5a62a116..b968d34fd8a1 100644 --- a/sysutils/cdrdao/Makefile +++ b/sysutils/cdrdao/Makefile @@ -1,6 +1,6 @@ PORTNAME= cdrdao DISTVERSION= 1_2_5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils audio MASTER_SITES= https://github.com/${PORTNAME}/${PORTNAME}/releases/download/rel_${DISTVERSION}/ \ SF/${PORTNAME}/rel_${DISTVERSION} diff --git a/sysutils/cdrdao/files/patch-dao_ScsiIf-freebsd-cam.cc b/sysutils/cdrdao/files/patch-dao_ScsiIf-freebsd-cam.cc new file mode 100644 index 000000000000..6b39efbe9ab9 --- /dev/null +++ b/sysutils/cdrdao/files/patch-dao_ScsiIf-freebsd-cam.cc @@ -0,0 +1,29 @@ +--- dao/ScsiIf-freebsd-cam.cc.orig 2023-01-25 14:30:35 UTC ++++ dao/ScsiIf-freebsd-cam.cc +@@ -112,11 +112,11 @@ int ScsiIf::sendCmd(const unsigned char *cmd, int cmdL + { + int retval; + int flags = CAM_DIR_NONE; +- u_int8_t * data_ptr; +- size_t data_len; ++ u_int8_t * data_ptr = NULL; ++ size_t data_len = 0; + +- bzero(impl_->ccb, sizeof(union ccb)); +- bcopy(cmd, &impl_->ccb->csio.cdb_io.cdb_bytes, cmdLen); ++ memset(impl_->ccb, 0, sizeof(union ccb)); ++ memmove(&impl_->ccb->csio.cdb_io.cdb_bytes, cmd, cmdLen); + + if (dataOut && dataOutLen > 0) { + data_ptr = (u_int8_t*) dataOut; +@@ -176,8 +176,8 @@ int ScsiIf::inquiry() + int i; + struct scsi_inquiry_data inq_data; + +- bzero(impl_->ccb, sizeof(union ccb)); +- bzero(&inq_data, sizeof(inq_data)); ++ memset(impl_->ccb, 0, sizeof(union ccb)); ++ memset(&inq_data, 0, sizeof(inq_data)); + + scsi_inquiry(&impl_->ccb->csio, + DEF_RETRY_COUNT, diff --git a/sysutils/cdrdao/files/patch-trackdb_FormatMp3.cc b/sysutils/cdrdao/files/patch-trackdb_FormatMp3.cc new file mode 100644 index 000000000000..7b8da328df14 --- /dev/null +++ b/sysutils/cdrdao/files/patch-trackdb_FormatMp3.cc @@ -0,0 +1,11 @@ +--- trackdb/FormatMp3.cc.orig 2023-02-03 14:46:06 UTC ++++ trackdb/FormatMp3.cc +@@ -111,7 +111,7 @@ FormatSupport::Status FormatMp3::madInit() + + // Initialize libao for WAV output; + ao_sample_format out_format; +- bzero(&out_format, sizeof(out_format)); ++ memset(&out_format, 0, sizeof(out_format)); + out_format.bits = 16; + out_format.rate = 44100; + out_format.channels = 2;