The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b7473a5d68b8ade1ce6c6c08965fe284cc70bd75

commit b7473a5d68b8ade1ce6c6c08965fe284cc70bd75
Author:     Warner Losh <[email protected]>
AuthorDate: 2025-09-28 17:58:31 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2025-09-29 01:45:01 +0000

    loader: make disable-device more rebust
    
    Check the number of arguments and ensure that the passed-in device to
    disable parses correctly.
    
    Sponsored by:           Netflix
---
 stand/lua/cli.lua | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua
index 596e55a8d1d8..dda8c3da4c89 100644
--- a/stand/lua/cli.lua
+++ b/stand/lua/cli.lua
@@ -235,9 +235,17 @@ cli["disable-device"] = function(...)
                return
        end
 
+       if #argv > 1 then
+               print("Too many arguments")
+               print("usage error: disable-device device")
+               return
+       end
+
        d, u = string.match(argv[1], "(%w*%a)(%d+)")
-       if d ~= nil then
+       if d ~= nil and u ~= nil then
                loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1")
+       else
+               print("Cannot parse " .. argv[1] .." into driver and unit 
number.")
        end
 end
 

Reply via email to