Remove unnecessary panic() in rread()
Ultimately, we throw an error when attempting to do a short read on a
directory.
Reported-by: syzbot+fbc1784c73dfdf878652@syzkaller.appspotmail.com
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/ns/sysfile.c b/kern/src/ns/sysfile.c
index 8ea6680..557f3ef 100644
--- a/kern/src/ns/sysfile.c
+++ b/kern/src/ns/sysfile.c
@@ -725,8 +725,10 @@
*/
if (dir) {
int amt;
- /* expecting only one dirent at a time, o/w we're busted */
- assert(n >= sizeof(struct kdirent));
+
+ if (n < sizeof(struct kdirent))
+ error(EINVAL, "readdir needs to read at least %d",
+ sizeof(struct kdirent));
if (!c->buf) {
c->buf = kmalloc(DIRREADSIZE, MEM_WAIT);
c->bufused = 0;