aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-01-02 18:10:47 +0000
committerMark Johnston <markj@FreeBSD.org>2024-01-03 01:00:26 +0000
commit823c8faa750685c75c8a9a701f0e36808dd7bd48 (patch)
tree6ad20a6a15277f4c2a44a18cd0247df454436cac
parent0524b7ffff66cbc220a165480cc553e8d18bdc91 (diff)
downloadports-823c8faa750685c75c8a9a701f0e36808dd7bd48.tar.gz
ports-823c8faa750685c75c8a9a701f0e36808dd7bd48.zip
net/aoe: Fix error handling for a copyout() call
This will soon be required by the base system. PR: 275986 Approved by: antoine
-rw-r--r--net/aoe/Makefile2
-rw-r--r--net/aoe/files/patch-aoeblk.c23
-rw-r--r--net/aoe/files/patch-aoecmd.c48
3 files changed, 67 insertions, 6 deletions
diff --git a/net/aoe/Makefile b/net/aoe/Makefile
index 1ad2f1cf6e69..4a1e523107f2 100644
--- a/net/aoe/Makefile
+++ b/net/aoe/Makefile
@@ -1,6 +1,6 @@
PORTNAME= aoe
PORTVERSION= 1.2.0
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= net
MASTER_SITES= https://people.freebsd.org/~sson/aoe/
DISTNAME= ${PORTNAME}-freebsd-${PORTVERSION}
diff --git a/net/aoe/files/patch-aoeblk.c b/net/aoe/files/patch-aoeblk.c
new file mode 100644
index 000000000000..7c096292da89
--- /dev/null
+++ b/net/aoe/files/patch-aoeblk.c
@@ -0,0 +1,23 @@
+--- aoeblk.c.orig 2024-01-03 00:56:10 UTC
++++ aoeblk.c
+@@ -114,7 +114,7 @@ aoeblk_ioctl(struct disk *disk, u_long cmd, void *vp,
+ {
+ struct ata_ioc_request *iocmd;
+ struct aoedev *d;
+- int n;
++ int error, n;
+
+ if (cmd != IOCATAREQUEST) {
+ IPRINTK("cmd %ld not IOCATA.\n", cmd);
+@@ -153,9 +153,9 @@ aoeblk_ioctl(struct disk *disk, u_long cmd, void *vp,
+
+ switch (iocmd->ata_ioc_request_ata.command) {
+ case ATA_ATA_IDENTIFY:
+- copyout(d->ad_ident, iocmd->ata_ioc_request_data, sizeof d->ad_ident);
++ error = copyout(d->ad_ident, iocmd->ata_ioc_request_data, sizeof d->ad_ident);
+ mtx_unlock(&d->ad_mtx);
+- return (0);
++ return (error);
+ case ATA_SMART:
+ if (iocmd->ata_ioc_request_ata.feature != ATA_SMART_ATTR_AUTOSAVE) {
+ n = aoecmd_ata_smart(d, iocmd);
diff --git a/net/aoe/files/patch-aoecmd.c b/net/aoe/files/patch-aoecmd.c
index 6868561e5ffb..7a8694ee7c81 100644
--- a/net/aoe/files/patch-aoecmd.c
+++ b/net/aoe/files/patch-aoecmd.c
@@ -1,6 +1,6 @@
---- aoecmd.c.orig 2006-05-26 00:13:09.000000000 +0700
-+++ aoecmd.c 2010-09-13 20:15:55.000000000 +0700
-@@ -44,6 +44,7 @@
+--- aoecmd.c.orig 2006-05-25 17:13:09 UTC
++++ aoecmd.c
+@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: src/sys/dev/aoe/aoecmd.c,v 1.23.2.
#include <sys/mutex.h>
#include <sys/mbuf.h>
#include <sys/sysctl.h>
@@ -8,7 +8,21 @@
#include <dev/aoe/aoe.h>
-@@ -427,29 +428,6 @@
+@@ -197,12 +198,11 @@ rexmit(struct aoedev *d, struct frame *f)
+ {
+ /* struct mbuf *m; */
+ struct aoe_hdr *h;
+- struct aoe_atahdr *ah;
+
+ h = (struct aoe_hdr *) f->f_hdr;
+- ah = (struct aoe_atahdr *) (h+1);
+
+ #ifdef AOE_DEBUG
++ struct aoe_atahdr *ah = (struct aoe_atahdr *) (h+1);
+
+ IPRINTK("mlen=%ld verfl=%X major=%X minor=%X cmd=%X\n"
+ "\ttag=%lX aflags=%X errfeat=%X scnt=%X cmdstat=%X\n"
+@@ -427,29 +427,6 @@ loop:
goto loop;
}
@@ -38,7 +52,7 @@
static void
ataid_complete(struct aoedev *d, char *id)
{
-@@ -457,13 +435,13 @@
+@@ -457,13 +434,13 @@ ataid_complete(struct aoedev *d, char *id)
memcpy(d->ad_ident, id, sizeof d->ad_ident);
@@ -55,3 +69,27 @@
}
if (aoeblk_register(d) != 0)
IPRINTK("could not register disk\n");
+@@ -614,7 +591,7 @@ aoecmd_ata_smart(struct aoedev *d, struct ata_ioc_requ
+ struct aoe_hdr *h;
+ struct aoe_atahdr *ah;
+ register daddr_t lba;
+- int timeout;
++ int error, timeout;
+
+ timeout = iocmd->ata_ioc_request_timeout;
+
+@@ -664,10 +641,12 @@ aoecmd_ata_smart(struct aoedev *d, struct ata_ioc_requ
+ iocmd->ata_ioc_request_ata.lba = lba;
+
+ if (iocmd->ata_ioc_request_flags == ATA_CMD_READ)
+- copyout(ah+1, iocmd->ata_ioc_request_data, iocmd->ata_ioc_request_count);
++ error = copyout(ah+1, iocmd->ata_ioc_request_data, iocmd->ata_ioc_request_count);
++ else
++ error = 0;
+
+ f->f_tag = FREETAG;
+- return (0);
++ return (error);
+ }
+
+ /* Set the write caching. */