On 24/10/25 17:48, Peter Maydell wrote:
On Fri, 24 Oct 2025 at 12:25, BALATON Zoltan <[email protected]> wrote:
On Fri, 24 Oct 2025, Vishal Chourasia wrote:
Add error checking for lseek() failure and provide better error
messages when image loading fails, including filenames and addresses.

Signed-off-by: Vishal Chourasia <[email protected]>
+    if (size > max_sz) {
+        error_setg(errp, "%s exceeds maximum image size (%" PRIu64 " MiB)",
+                   filename, max_sz / MiB);
MiB is arbitrary here. This function is used to load all kinds of images
such as ROMs which may be 64k-2MB or even executables in generic loader
that can be a few kilobytes. This might result in errors saying max size
is 0 MiB if the allowed size is less than a MiB (e.g. amigaone PROM_SIZE =
512 KiB) and integer division discards fractions. Do we have a function to
pretty print sizes or maybe this should be left as bytes or at most
kilobytes?
Yes, we have size_to_str() for this purpose.

Thanks Peter, I will add it in next version.

vishalc


Reply via email to