Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178272295
D62361.1796389173.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D62361.1796389173.diff
View Options
diff --git a/sys/powerpc/powernv/opal_async.c b/sys/powerpc/powernv/opal_async.c
--- a/sys/powerpc/powernv/opal_async.c
+++ b/sys/powerpc/powernv/opal_async.c
@@ -52,6 +52,7 @@
};
struct async_completion *completions;
+static int ntokens;
/* Setup the token pool. */
int
@@ -65,6 +66,7 @@
M_WAITOK | M_FIRSTFIT);
completions = malloc(count * sizeof(struct async_completion),
M_DEVBUF, M_WAITOK | M_ZERO);
+ ntokens = count;
EVENTHANDLER_REGISTER(OPAL_ASYNC_COMP, opal_handle_async_completion,
NULL, EVENTHANDLER_PRI_ANY);
@@ -117,9 +119,15 @@
static void opal_handle_async_completion(void *arg, struct opal_msg *msg)
{
- int token;
-
- token = msg->params[0];
+ uint64_t token;
+
+ /* OPAL messages are big-endian. */
+ token = be64toh(msg->params[0]);
+ if (token >= ntokens) {
+ printf("OPAL: async completion for bad token %ju\n",
+ (uintmax_t)token);
+ return;
+ }
memcpy(&completions[token].msg, msg, sizeof(*msg));
atomic_thread_fence_rel();
completions[token].completed = true;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 4, 12:59 PM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42207880
Default Alt Text
D62361.1796389173.diff (1 KB)
Attached To
Mode
D62361: powerpc/powernv: byte swap the OPAL async completion token
Attached
Detach File
Event Timeline